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

View File

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