mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-28 10:50:15 +00:00
stdenv/problems: use generated problems for legacy field values (#557381)
This commit is contained in:
@@ -18,6 +18,7 @@ let
|
||||
isFunction
|
||||
isString
|
||||
length
|
||||
mapAttrsToList
|
||||
mutuallyExclusive
|
||||
optional
|
||||
optionalString
|
||||
@@ -25,6 +26,7 @@ let
|
||||
unsafeGetAttrPos
|
||||
warn
|
||||
all
|
||||
groupBy
|
||||
;
|
||||
|
||||
inherit (lib.lists)
|
||||
@@ -134,8 +136,6 @@ let
|
||||
|
||||
hasUnfreeLicense = attrs: attrs ? meta.license && isUnfree attrs.meta.license;
|
||||
|
||||
isMarkedBroken = attrs: attrs.meta.broken or false;
|
||||
|
||||
# Logical inversion of meta.availableOn for hostPlatform
|
||||
hasUnsupportedPlatform =
|
||||
if allowUnsupportedSystem then
|
||||
@@ -450,6 +450,9 @@ let
|
||||
# meta = checkMeta.commonMeta hostPlatform { inherit validity attrs pos references; };
|
||||
# validity = checkMeta.assertValidity hostPlatform { inherit meta attrs; };
|
||||
commonMeta =
|
||||
let
|
||||
completeMetaProblems' = completeMetaProblems config;
|
||||
in
|
||||
hostPlatform:
|
||||
let
|
||||
hasUnsupportedPlatform' = hasUnsupportedPlatform hostPlatform;
|
||||
@@ -465,6 +468,17 @@ let
|
||||
hasOutput = out: elem out outputs;
|
||||
maintainersPosition = unsafeGetAttrPos "maintainers" (attrs.meta or { });
|
||||
teamsPosition = unsafeGetAttrPos "teams" (attrs.meta or { });
|
||||
|
||||
problems = completeMetaProblems' attrs;
|
||||
problemsGroupedByKind = groupBy (p: p.name) (
|
||||
mapAttrsToList (name: problem: {
|
||||
inherit name;
|
||||
inherit problem;
|
||||
}) problems
|
||||
);
|
||||
|
||||
problemsByKind = kind: problemsGroupedByKind.${kind} or [ ];
|
||||
hasProblemKind = kind: (problemsByKind kind) != [ ];
|
||||
in
|
||||
{
|
||||
# `name` derivation attribute includes cross-compilation cruft,
|
||||
@@ -591,11 +605,11 @@ let
|
||||
|
||||
# Expose the result of the checks for everyone to see.
|
||||
unfree = hasUnfreeLicense attrs;
|
||||
broken = isMarkedBroken attrs;
|
||||
broken = hasProblemKind "broken";
|
||||
unsupported = hasUnsupportedPlatform' attrs;
|
||||
insecure = isMarkedInsecure attrs;
|
||||
|
||||
problems = completeMetaProblems config attrs;
|
||||
inherit problems;
|
||||
|
||||
available =
|
||||
validity.valid != "no"
|
||||
|
||||
@@ -525,9 +525,13 @@ rec {
|
||||
processProblems pname problemsToHandle;
|
||||
|
||||
completeMetaProblems =
|
||||
config: attrs:
|
||||
config:
|
||||
let
|
||||
automaticProblems = genAutomaticProblems config;
|
||||
in
|
||||
attrs:
|
||||
mapAttrs (name: problem: { kind = name; } // problem) (
|
||||
(attrs.meta.problems or { }) // genAutomaticProblems config attrs
|
||||
(attrs.meta.problems or { }) // automaticProblems attrs
|
||||
);
|
||||
|
||||
processProblems =
|
||||
|
||||
Reference in New Issue
Block a user