Merge pull request #311069 from nbraud/fix-307770

testers.hasPkgConfigModules: fix bug in `versionCheck` handling
This commit is contained in:
Robert Hensing 2024-05-21 00:13:09 +02:00 committed by GitHub
commit 28df2298ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -45,7 +45,7 @@ runCommand testName {
if [[ "$moduleVersion" == "$version" ]]; then
echo " pkg-config module $moduleName exists and has version $moduleVersion"
else
echo " pkg-config module $moduleName exists and has version $moduleVersion when $version was expected"
echo "${if versionCheck then "" else ""} pkg-config module $moduleName exists at version $moduleVersion != $version (drv version)"
((versionMismatch+=1))
fi
printf '%s\t%s\n' "$moduleName" "$version" >> "$out"
@ -55,7 +55,7 @@ runCommand testName {
fi
done
if [[ $notFound -eq 0 ]] && ([[ $versionMismatch -eq 0 ]] || [[ "$versionCheck" == false ]]); then
if [[ $notFound -eq 0 ]] && ([[ $versionMismatch -eq 0 ]] || [[ -z "$versionCheck" ]]); then
exit 0
fi
if [[ $notFound -ne 0 ]]; then

View File

@ -11,10 +11,15 @@ lib.recurseIntoAttrs {
miniz-versions-mismatch = testers.testBuildFailure (testers.hasPkgConfigModules {
package = miniz;
version = "1.2.3";
version = "1.2.3"; # Deliberately-incorrect version number
versionCheck = true;
});
miniz-no-versionCheck = testers.hasPkgConfigModules {
package = miniz;
version = "1.2.3"; # Deliberately-incorrect version number
};
zlib-has-zlib = testers.hasPkgConfigModules {
package = zlib;
moduleNames = [ "zlib" ];