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:
Silvan Mosberger 2026-06-19 16:37:00 +02:00 committed by github-actions[bot]
commit 45a743c9f3
2 changed files with 13 additions and 3 deletions

View file

@ -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);

View file

@ -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