ci/eval/attrpaths: refactor
The following changes were made: - Using `lib.` instead of `builtins.` - Using `mapAttrsToList` instead of `mapAttrs` + `attrValues` - Joining two of the if conditions with the same return value - Using `traceIf` instead of `if` / `else` - Using `showAttrPath` instead of `concatStringsSep`
This commit is contained in:
@@ -36,11 +36,13 @@ let
|
|||||||
# attrnames of derivations (!). We should probably restructure
|
# attrnames of derivations (!). We should probably restructure
|
||||||
# the job tree so that this is not the case.
|
# the job tree so that this is not the case.
|
||||||
#
|
#
|
||||||
|
# TODO: Use mapAttrsToListRecursiveCond when this PR lands:
|
||||||
|
# https://github.com/NixOS/nixpkgs/pull/395160
|
||||||
justAttrNames =
|
justAttrNames =
|
||||||
path: value:
|
path: value:
|
||||||
let
|
let
|
||||||
result =
|
result =
|
||||||
if path == [ "AAAAAASomeThingsFailToEvaluate" ] then
|
if path == [ "AAAAAASomeThingsFailToEvaluate" ] || !(lib.isAttrs value) then
|
||||||
[ ]
|
[ ]
|
||||||
else if
|
else if
|
||||||
lib.isDerivation value
|
lib.isDerivation value
|
||||||
@@ -49,27 +51,22 @@ let
|
|||||||
!(value.__recurseIntoDerivationForReleaseJobs or false)
|
!(value.__recurseIntoDerivationForReleaseJobs or false)
|
||||||
then
|
then
|
||||||
[ path ]
|
[ path ]
|
||||||
|
|
||||||
else if !(lib.isAttrs value) then
|
|
||||||
[ ]
|
|
||||||
else
|
else
|
||||||
lib.pipe value [
|
lib.pipe value [
|
||||||
(builtins.mapAttrs (
|
(lib.mapAttrsToList (
|
||||||
name: value:
|
name: value:
|
||||||
builtins.addErrorContext "while evaluating package set attribute path '${
|
lib.addErrorContext "while evaluating package set attribute path '${
|
||||||
lib.showAttrPath (path ++ [ name ])
|
lib.showAttrPath (path ++ [ name ])
|
||||||
}'" (justAttrNames (path ++ [ name ]) value)
|
}'" (justAttrNames (path ++ [ name ]) value)
|
||||||
))
|
))
|
||||||
builtins.attrValues
|
lib.concatLists
|
||||||
builtins.concatLists
|
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
if !trace then result else lib.trace "** ${lib.concatStringsSep "." path}" result;
|
lib.traceIf trace "** ${lib.showAttrPath path}" result;
|
||||||
|
|
||||||
outpaths = import ./outpaths.nix {
|
outpaths = import ./outpaths.nix {
|
||||||
inherit checkMeta;
|
inherit checkMeta path;
|
||||||
attrNamesOnly = true;
|
attrNamesOnly = true;
|
||||||
inherit path;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
paths = [
|
paths = [
|
||||||
@@ -91,7 +88,7 @@ let
|
|||||||
]
|
]
|
||||||
++ justAttrNames [ ] outpaths;
|
++ justAttrNames [ ] outpaths;
|
||||||
|
|
||||||
names = map (path: (lib.concatStringsSep "." path)) paths;
|
names = map lib.showAttrPath paths;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user