From b0482248fefbf3b6cdd9c92053cfb49778a3a3a8 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 27 Mar 2018 08:12:14 -0400 Subject: meta: Add badPlatforms attribute for platform blacklisting. --- pkgs/stdenv/generic/check-meta.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkgs/stdenv/generic/check-meta.nix') diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 113b95f3ab00..2f4ff62f767e 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -165,6 +165,7 @@ let isFcitxEngine = bool; isIbusEngine = bool; isGutenprint = bool; + badPlatforms = platforms; }; checkMetaAttr = k: v: @@ -174,7 +175,8 @@ let checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else []; checkPlatform = attrs: - lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms; + (!(attrs ? meta.platforms) || lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms) && + (!(attrs ? meta.badPlatforms && lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.badPlatforms)); # Check if a derivation is valid, that is whether it passes checks for # e.g brokenness or license. @@ -189,7 +191,7 @@ let { valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; } else if !allowBroken && attrs.meta.broken or false then { valid = false; reason = "broken"; errormsg = "is marked as broken"; } - else if !allowUnsupportedSystem && !allowBroken && attrs.meta.platforms or null != null && !(checkPlatform attrs) then + else if !allowUnsupportedSystem && !allowBroken && !(checkPlatform attrs) then { valid = false; reason = "broken"; errormsg = "is not supported on ‘${hostPlatform.config}’"; } else if !(hasAllowedInsecure attrs) then { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; } -- cgit 1.4.1