diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-08-27 12:10:56 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-08-27 15:32:45 +0200 |
commit | f15270833ad3e843619fc953e4b28e2d9499b3f2 (patch) | |
tree | 58394c582facea433efa919cd0ac8d26e4c3a7bf /pkgs/stdenv | |
parent | 6fe75323961b4e23fd5ce71b044700c9377cbfd0 (diff) | |
download | nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.gz nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.bz2 nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.lz nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.xz nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.tar.zst nixlib-f15270833ad3e843619fc953e4b28e2d9499b3f2.zip |
Don't barf JSON at users in error messages
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/default.nix | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index fe7bec54ba02..249e4845bc28 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -27,7 +27,7 @@ let lib.lists.all (license: let l = lib.licenses.${license.shortName or "BROKEN"} or false; in if license == l then true else - throw ''‘${builtins.toJSON license}’ is not an attribute of lib.licenses'' + throw ''‘${showLicense license}’ is not an attribute of lib.licenses'' ) list; mutuallyExclusive = a: b: @@ -73,6 +73,8 @@ let isUnfree (lib.lists.toList attrs.meta.license) && !allowUnfreePredicate attrs; + showLicense = license: license.shortName or "unknown"; + defaultNativeBuildInputs = extraBuildInputs ++ [ ../../build-support/setup-hooks/move-docs.sh ../../build-support/setup-hooks/compress-man-pages.sh @@ -121,9 +123,9 @@ let licenseAllowed = attrs: if hasDeniedUnfreeLicense attrs && !(hasWhitelistedLicense attrs) then - throwEvalHelp "Unfree" "has an unfree license ‘${builtins.toJSON attrs.meta.license}’ which is not whitelisted" + throwEvalHelp "Unfree" "has an unfree license (‘${showLicense attrs.meta.license}’)" else if hasBlacklistedLicense attrs then - throwEvalHelp "blacklisted" "has the ‘${builtins.toJSON attrs.meta.license}’ license which is blacklisted" + throwEvalHelp "blacklisted" "has a blacklisted license (‘${showLicense attrs.meta.license}’)" else if !allowBroken && attrs.meta.broken or false then throwEvalHelp "Broken" "is marked as broken" else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then |