Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testers.hasPkgConfigModules: fix bug in versionCheck handling #311069

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkgs/build-support/testers/hasPkgConfigModules/tester.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion pkgs/build-support/testers/hasPkgConfigModules/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ];
Expand Down