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

check-meta.nix: fix self-contradictory error messages #222852

Merged
merged 1 commit into from Mar 24, 2023
Merged
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
16 changes: 12 additions & 4 deletions pkgs/stdenv/generic/check-meta.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ let

showLicenseOrSourceType = value: toString (map (v: v.shortName or "unknown") (lib.lists.toList value));
showLicense = showLicenseOrSourceType;
showPlatforms = attrs: toString (builtins.filter
(system: lib.meta.availableOn (lib.systems.elaborate { inherit system; }) attrs)
lib.platforms.all);
showSourceType = showLicenseOrSourceType;

pos_str = meta: meta.position or "«unknown-file»";
Expand Down Expand Up @@ -371,7 +368,18 @@ let
else if !allowBroken && attrs.meta.broken or false then
{ valid = "no"; reason = "broken"; errormsg = "is marked as broken"; }
else if !allowUnsupportedSystem && hasUnsupportedPlatform attrs then
{ valid = "no"; reason = "unsupported"; errormsg = "is only supported on `${showPlatforms attrs}` but not on requested ‘${hostPlatform.system}’"; }
let toPretty = lib.generators.toPretty {
allowPrettyValues = true;
indent = " ";
};
in { valid = "no"; reason = "unsupported";
errormsg = ''
is not available on the requested hostPlatform:
hostPlatform.config = "${hostPlatform.config}"
package.meta.platforms = ${toPretty (attrs.meta.platforms or [])}
package.meta.badPlatforms = ${toPretty (attrs.meta.badPlatforms or [])}
'';
}
else if !(hasAllowedInsecure attrs) then
{ valid = "no"; reason = "insecure"; errormsg = "is marked as insecure"; }

Expand Down