mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
meta.problems: Fill out output meta with final list of problems
This ensures that external tooling can also process the problems, and
helps users with debugging.
(cherry picked from commit 8fcbb35929)
This commit is contained in:
parent
ff79595a29
commit
45a743c9f3
2 changed files with 13 additions and 3 deletions
|
|
@ -50,6 +50,7 @@ let
|
|||
inherit (import ./problems.nix { inherit lib; })
|
||||
problemsType
|
||||
genCheckProblems
|
||||
completeMetaProblems
|
||||
;
|
||||
checkProblems = genCheckProblems config;
|
||||
|
||||
|
|
@ -639,6 +640,8 @@ let
|
|||
unsupported = hasUnsupportedPlatform attrs;
|
||||
insecure = isMarkedInsecure attrs;
|
||||
|
||||
problems = completeMetaProblems config attrs;
|
||||
|
||||
available =
|
||||
validity.valid != "no"
|
||||
&& ((config.checkMetaRecursively or false) -> all (d: d.meta.available or true) references);
|
||||
|
|
|
|||
|
|
@ -255,7 +255,8 @@ rec {
|
|||
record
|
||||
enum
|
||||
;
|
||||
kindType = enum (attrNames manualKinds);
|
||||
# While we should only allow manual kinds, we need to allow `meta.problems = otherPackage.meta.problems`, which includes automatic ones as well
|
||||
kindType = enum (attrNames kinds);
|
||||
subRecord = record {
|
||||
kind = kindType;
|
||||
message = str;
|
||||
|
|
@ -275,7 +276,7 @@ rec {
|
|||
let
|
||||
kindGroups = groupBy (kind: kind) (mapAttrsToList (name: problem: problem.kind or name) v);
|
||||
in
|
||||
all (kind: manualKinds ? ${kind} && (uniqueKinds ? ${kind} -> length kindGroups.${kind} == 1)) (
|
||||
all (kind: kinds ? ${kind} && (uniqueKinds ? ${kind} -> length kindGroups.${kind} == 1)) (
|
||||
attrNames kindGroups
|
||||
)
|
||||
);
|
||||
|
|
@ -299,7 +300,7 @@ rec {
|
|||
++ concatLists (
|
||||
mapAttrsToList (
|
||||
kind: kindGroup:
|
||||
optionals (!manualKinds ? ${kind}) (
|
||||
optionals (!kinds ? ${kind}) (
|
||||
map (
|
||||
el:
|
||||
"${ctx}.${el.name}: Problem kind ${kind}, inferred from the problem name, is invalid; expected ${kindType.name}. You can specify an explicit problem kind with `${ctx}.${el.name}.kind`"
|
||||
|
|
@ -515,6 +516,12 @@ rec {
|
|||
in
|
||||
processProblems pname problemsToHandle;
|
||||
|
||||
completeMetaProblems =
|
||||
config: attrs:
|
||||
mapAttrs (name: problem: { kind = name; } // problem) (
|
||||
(attrs.meta.problems or { }) // genAutomaticProblems config attrs
|
||||
);
|
||||
|
||||
processProblems =
|
||||
pname: problemsToHandle:
|
||||
let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue