mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 09:53:10 +00:00
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.
This commit is contained in:
parent
f2236425b9
commit
b12605563f
@ -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»";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user