summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorGraham Bennett <graham@grahambennett.org>2019-10-27 10:15:48 +0000
committerGraham Bennett <graham@grahambennett.org>2019-10-27 10:23:53 +0000
commitb12605563f5692ae146cdc40a2d8eb1c6d338501 (patch)
tree4bd9e281b8f3a0188219830e215925673bf9eabc /pkgs/stdenv
parentf2236425b9f2176d165b9b303d5907b1a3f9b97e (diff)
downloadnixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.tar
nixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.tar.gz
nixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.tar.bz2
nixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.tar.lz
nixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.tar.xz
nixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.tar.zst
nixpkgs-b12605563f5692ae146cdc40a2d8eb1c6d338501.zip
Fix handling of lists in whitelistedLicenses and blacklistedLicenses
A package's meta.license can either be a single license or a list.  The
code to check config.whitelistedLicenses and config.blackListedLicenses
wasn't handling this, nor was the showLicense function.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/check-meta.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index b754230b0be..6bd6a9bf41e 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -36,10 +36,10 @@ let
     attrs ? meta.license;
 
   hasWhitelistedLicense = assert areLicenseListsValid; attrs:
-    hasLicense attrs && builtins.elem attrs.meta.license whitelist;
+    hasLicense attrs && lib.lists.any (l: builtins.elem l whitelist) (lib.lists.toList attrs.meta.license);
 
   hasBlacklistedLicense = assert areLicenseListsValid; attrs:
-    hasLicense attrs && builtins.elem attrs.meta.license blacklist;
+    hasLicense attrs && lib.lists.any (l: builtins.elem l blacklist) (lib.lists.toList attrs.meta.license);
 
   allowBroken = config.allowBroken or false
     || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
@@ -75,7 +75,7 @@ let
     allowInsecurePredicate attrs ||
     builtins.getEnv "NIXPKGS_ALLOW_INSECURE" == "1";
 
-  showLicense = license: license.shortName or "unknown";
+  showLicense = license: toString (map (l: l.shortName or "unknown") (lib.lists.toList license));
 
   pos_str = meta: meta.position or "«unknown-file»";