about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-03-24 09:55:22 +0200
committerGitHub <noreply@github.com>2023-03-24 09:55:22 +0200
commitd4660b45bc031d98cecd233babf1df7f6d64b65e (patch)
tree7c6d34181b8aa5871d53efc2fbfa9aa7a6afa9b2
parentb5c040af03b9ab9616ba84dececbddcc16767acb (diff)
parent13507da345589a2de155a83ff1b79a63437c9abf (diff)
Merge pull request #222852 from amjoseph-nixpkgs/pr/wegank/platforms
check-meta.nix: fix self-contradictory error messages
-rw-r--r--pkgs/stdenv/generic/check-meta.nix16
1 files changed, 12 insertions, 4 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 1118e6837f294..7f317c787b04e 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -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»";
@@ -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"; }