Skip to content

Commit

Permalink
pkgs/top-level/release.nix: Don't include non-Hydra attributes with a…
Browse files Browse the repository at this point in the history
…ttrNamesOnly

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.
  • Loading branch information
infinisil committed Nov 20, 2024
1 parent f8d0c64 commit 72f462b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
23 changes: 16 additions & 7 deletions pkgs/top-level/release-lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -188,6 +195,8 @@ in {
lib
mapTestOn
mapTestOnCross
recursiveMapPackages
getPlatforms
packagePlatforms
pkgs
pkgsFor
Expand Down
9 changes: 5 additions & 4 deletions pkgs/top-level/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 72f462b

Please sign in to comment.