lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 24.11-pre 70 lines 2.4 kB view raw
1# Static arguments 2{ lib, runCommand, pkg-config }: 3 4# Tester arguments 5{ package, 6 moduleNames ? package.meta.pkgConfigModules, 7 testName ? "check-pkg-config-${lib.concatStringsSep "-" moduleNames}", 8 version ? package.version or null, 9 versionCheck ? false, 10}: 11 12runCommand testName { 13 nativeBuildInputs = [ pkg-config ]; 14 buildInputs = [ package ]; 15 inherit moduleNames version versionCheck; 16 meta = { 17 description = "Test whether ${package.name} exposes pkg-config modules ${lib.concatStringsSep ", " moduleNames}."; 18 } 19 # Make sure licensing info etc is preserved, as this is a concern for e.g. cache.nixos.org, 20 # as hydra can't check this meta info in dependencies. 21 # The test itself is just Nixpkgs, with MIT license. 22 // builtins.intersectAttrs 23 { 24 available = throw "unused"; 25 broken = throw "unused"; 26 insecure = throw "unused"; 27 license = throw "unused"; 28 maintainers = throw "unused"; 29 platforms = throw "unused"; 30 unfree = throw "unused"; 31 unsupported = throw "unused"; 32 } 33 package.meta; 34 } '' 35 touch "$out" 36 notFound=0 37 versionMismatch=0 38 for moduleName in $moduleNames; do 39 echo "checking pkg-config module $moduleName in $buildInputs" 40 set +e 41 moduleVersion="$($PKG_CONFIG --modversion $moduleName)" 42 r=$? 43 set -e 44 if [[ $r = 0 ]]; then 45 if [[ "$moduleVersion" == "$version" ]]; then 46 echo " pkg-config module $moduleName exists and has version $moduleVersion" 47 else 48 echo "${if versionCheck then "" else ""} pkg-config module $moduleName exists at version $moduleVersion != $version (drv version)" 49 ((versionMismatch+=1)) 50 fi 51 printf '%s\t%s\n' "$moduleName" "$version" >> "$out" 52 else 53 echo " pkg-config module $moduleName was not found" 54 ((notFound+=1)) 55 fi 56 done 57 58 if [[ $notFound -eq 0 ]] && ([[ $versionMismatch -eq 0 ]] || [[ -z "$versionCheck" ]]); then 59 exit 0 60 fi 61 if [[ $notFound -ne 0 ]]; then 62 echo "$notFound modules not found" 63 echo "These modules were available in the input propagation closure:" 64 $PKG_CONFIG --list-all 65 fi 66 if [[ $versionMismatch -ne 0 ]]; then 67 echo "$versionMismatch version mismatches" 68 fi 69 exit 1 70 ''