stdenv/check-meta: Inherit remaining lib access into scope

Hopefully this will result in people not adding new `lib.xxx` to check-meta.nix.
This commit is contained in:
adisbladis 2024-03-30 19:20:59 +13:00
parent f8b091d53f
commit dc49349c84

View File

@ -31,6 +31,14 @@ let
toList
isList
elem
;
inherit (lib.meta)
availableOn
;
inherit (lib.generators)
toPretty
;
# If we're in hydra, we can dispense with the more verbose error
@ -86,7 +94,7 @@ let
# was `licenses: lib.lists.any (l: !l.free or true) licenses;`
# which always evaluates to `!true` for strings.
else if isString licenses then false
else lib.lists.any (l: !l.free or true) licenses;
else any (l: !l.free or true) licenses;
hasUnfreeLicense = attrs: hasLicense attrs && isUnfree attrs.meta.license;
@ -96,7 +104,7 @@ let
isMarkedBroken = attrs: attrs.meta.broken or false;
hasUnsupportedPlatform =
pkg: !(lib.meta.availableOn hostPlatform pkg);
pkg: !(availableOn hostPlatform pkg);
isMarkedInsecure = attrs: (attrs.meta.knownVulnerabilities or []) != [];
@ -366,7 +374,7 @@ let
[ ]
else
[ "key 'meta.${k}' has invalid value; expected ${metaTypes.${k}.name}, got\n ${
lib.generators.toPretty { indent = " "; } v
toPretty { indent = " "; } v
}" ]
else
[ "key 'meta.${k}' is unrecognized; expected one of: \n [${concatMapStringsSep ", " (x: "'${x}'") (attrNames metaTypes)}]" ];
@ -416,7 +424,7 @@ 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
let toPretty = lib.generators.toPretty {
let toPretty = toPretty {
allowPrettyValues = true;
indent = " ";
};