ci/eval/compare: don't treat renames as rebuilds
When a package's attrpath is renamed it is currently treated as a rebuild, even though the outpath already exists and is already cached. This also happens when adding new names for packagesets that already exist, for example when starting to eval `perlPackages` in CI, which is just the same as `perl540Packages` currently. It would also happen when `perlPackages` is switched from `perl540Packages` to `perl999Packages`. Assuming that `perl999Packages` had already been built before, this doesn't really cause any rebuilds.
This commit is contained in:
parent
6de5b1c4e9
commit
c5c7cd5bc7
@ -73,12 +73,11 @@ let
|
|||||||
;
|
;
|
||||||
|
|
||||||
# Attrs
|
# Attrs
|
||||||
# - keys: "added", "changed" and "removed"
|
# - keys: "added", "changed", "removed" and "rebuilds"
|
||||||
# - values: lists of `packagePlatformPath`s
|
# - values: lists of `packagePlatformPath`s
|
||||||
diffAttrs = builtins.fromJSON (builtins.readFile "${combinedDir}/combined-diff.json");
|
diffAttrs = builtins.fromJSON (builtins.readFile "${combinedDir}/combined-diff.json");
|
||||||
|
|
||||||
rebuilds = diffAttrs.added ++ diffAttrs.changed;
|
rebuildsPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.rebuilds;
|
||||||
rebuildsPackagePlatformAttrs = convertToPackagePlatformAttrs rebuilds;
|
|
||||||
|
|
||||||
changed-paths =
|
changed-paths =
|
||||||
let
|
let
|
||||||
@ -90,7 +89,7 @@ let
|
|||||||
in
|
in
|
||||||
writeText "changed-paths.json" (
|
writeText "changed-paths.json" (
|
||||||
builtins.toJSON {
|
builtins.toJSON {
|
||||||
attrdiff = lib.mapAttrs (_: extractPackageNames) diffAttrs;
|
attrdiff = lib.mapAttrs (_: extractPackageNames) { inherit (diffAttrs) added changed removed; };
|
||||||
inherit
|
inherit
|
||||||
rebuildsByPlatform
|
rebuildsByPlatform
|
||||||
rebuildsByKernel
|
rebuildsByKernel
|
||||||
|
|||||||
@ -218,7 +218,8 @@ let
|
|||||||
reduce .[] as $item ({}; {
|
reduce .[] as $item ({}; {
|
||||||
added: (.added + $item.added),
|
added: (.added + $item.added),
|
||||||
changed: (.changed + $item.changed),
|
changed: (.changed + $item.changed),
|
||||||
removed: (.removed + $item.removed)
|
removed: (.removed + $item.removed),
|
||||||
|
rebuilds: (.rebuilds + $item.rebuilds)
|
||||||
})
|
})
|
||||||
' > $out/combined-diff.json
|
' > $out/combined-diff.json
|
||||||
|
|
||||||
|
|||||||
@ -18,13 +18,20 @@ let
|
|||||||
added: [ <keys only in the second object> ],
|
added: [ <keys only in the second object> ],
|
||||||
removed: [ <keys only in the first object> ],
|
removed: [ <keys only in the first object> ],
|
||||||
changed: [ <keys with different values between the two objects> ],
|
changed: [ <keys with different values between the two objects> ],
|
||||||
|
rebuilds: [ <keys in the second object with values not present at all in first object> ],
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
diff =
|
diff =
|
||||||
|
old: new:
|
||||||
let
|
let
|
||||||
filterKeys = cond: attrs: lib.attrNames (lib.filterAttrs cond attrs);
|
filterKeys = cond: attrs: lib.attrNames (lib.filterAttrs cond attrs);
|
||||||
|
oldOutputs = lib.pipe old [
|
||||||
|
(lib.mapAttrsToList (_: lib.attrValues))
|
||||||
|
lib.concatLists
|
||||||
|
(lib.flip lib.genAttrs (_: true))
|
||||||
|
];
|
||||||
in
|
in
|
||||||
old: new: {
|
{
|
||||||
added = filterKeys (n: _: !(old ? ${n})) new;
|
added = filterKeys (n: _: !(old ? ${n})) new;
|
||||||
removed = filterKeys (n: _: !(new ? ${n})) old;
|
removed = filterKeys (n: _: !(new ? ${n})) old;
|
||||||
changed = filterKeys (
|
changed = filterKeys (
|
||||||
@ -35,6 +42,16 @@ let
|
|||||||
# Filter out attributes that are the same as the new value
|
# Filter out attributes that are the same as the new value
|
||||||
&& (v != (new.${n}))
|
&& (v != (new.${n}))
|
||||||
) old;
|
) old;
|
||||||
|
# A "rebuild" is every attrpath ...
|
||||||
|
rebuilds = filterKeys (
|
||||||
|
_: pkg:
|
||||||
|
# ... that has at least one output ...
|
||||||
|
lib.any (
|
||||||
|
output:
|
||||||
|
# ... which has not been built in "old" already.
|
||||||
|
!(oldOutputs ? ${output})
|
||||||
|
) (lib.attrValues pkg)
|
||||||
|
) new;
|
||||||
};
|
};
|
||||||
|
|
||||||
getAttrs =
|
getAttrs =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user