pkgs/top-level/release.nix: Don't include non-Hydra attributes with attrNamesOnly

The attrNamesOnly feature is used by
pkgs/top-level/release-attrpaths-superset.nix to return a superset of
all attributes that might be built by Hydra.

Before this change it would include all attribute paths to derivations that could
be found recursively, ignoring the recurseForDerivations and
recurseForRelease attributes that control Hydra's recursion.

This had the effect that it would end up with ~266000 attributes, most of which definitely won't be built by Hydra. We can remove those while staying true to the superset notion to end up with just ~97000, a reduction of ~63.6%! This also comes with an eval time reduction from 31.7s to 18.7s (-41.0%)!

As an example, all derivations in pypy310Packages don't get included
anymore, because it doesn't have a `.recurseForDerivations` set.

As a nice side effect, with `--arg enableWarnings false`, no more
warnings are printed, because things like
`checkpointBuildTools.mkCheckpointedBuild` (which is deprecated) isn't
being recursed to anymore.
This commit is contained in:
Silvan Mosberger 2024-11-20 05:52:51 +01:00
parent f8d0c644a2
commit 72f462bdba
2 changed files with 21 additions and 11 deletions

View File

@ -163,19 +163,26 @@ let
(addMetaAttrs { maintainers = crossMaintainers; });
/* Recursively map a (nested) set of derivations to an isomorphic
set of meta.platforms values. */
packagePlatforms = mapAttrs (name: value:
/* Recursive for packages and apply a function to them */
recursiveMapPackages = f: mapAttrs (name: value:
if isDerivation value then
value.meta.hydraPlatforms
or (subtractLists (value.meta.badPlatforms or [])
(value.meta.platforms or supportedSystems))
f value
else if value.recurseForDerivations or false || value.recurseForRelease or false then
packagePlatforms value
recursiveMapPackages f value
else
[]
);
/* Gets the list of Hydra platforms for a derivation */
getPlatforms = drv:
drv.meta.hydraPlatforms
or (subtractLists (drv.meta.badPlatforms or [])
(drv.meta.platforms or supportedSystems));
/* Recursively map a (nested) set of derivations to an isomorphic
set of meta.platforms values. */
packagePlatforms = recursiveMapPackages getPlatforms;
in {
/* Common platform groups on which to test packages. */
inherit (platforms) unix linux darwin cygwin all;
@ -188,6 +195,8 @@ in {
lib
mapTestOn
mapTestOnCross
recursiveMapPackages
getPlatforms
packagePlatforms
pkgs
pkgsFor

View File

@ -321,8 +321,9 @@ let
# Conflicts usually cause silent job drops like in
# https://github.com/NixOS/nixpkgs/pull/182058
jobs = let
packagePlatforms = if attrNamesOnly then id else release-lib.packagePlatforms;
packageJobs = {
packagePlatforms = release-lib.recursiveMapPackages
(if attrNamesOnly then id else release-lib.getPlatforms);
packageJobs = packagePlatforms pkgs // {
haskell.compiler = packagePlatforms pkgs.haskell.compiler;
haskellPackages = packagePlatforms pkgs.haskellPackages;
# Build selected packages (HLS) for multiple Haskell compilers to rebuild
@ -363,8 +364,8 @@ let
};
mapTestOn-packages =
if attrNamesOnly
then pkgs // packageJobs
else mapTestOn ((packagePlatforms pkgs) // packageJobs);
then packageJobs
else mapTestOn packageJobs;
in
unionOfDisjoint nonPackageJobs mapTestOn-packages;