make-initrd: use closureInfo again (#372931)

This commit is contained in:
Philip Taron
2025-03-09 18:48:12 -07:00
committed by GitHub
6 changed files with 5 additions and 83 deletions

View File

@@ -102,10 +102,10 @@ with lib;
stdenv
stdenvNoCC # for runCommand
busybox
jq # for closureInfo
# For boot.initrd.systemd
makeInitrdNGTool
];
]
++ jq.all; # for closureInfo
boot.swraid.enable = true;
# remove warning about unset mail

View File

@@ -20,7 +20,6 @@ let
in
{
stdenvNoCC,
perl,
cpio,
ubootTools,
lib,
@@ -101,7 +100,6 @@ stdenvNoCC.mkDerivation (
builder = ./make-initrd.sh;
nativeBuildInputs = [
perl
cpio
] ++ lib.optional makeUInitrd ubootTools;
@@ -121,14 +119,7 @@ stdenvNoCC.mkDerivation (
symlinks = map (x: x.symlink) contents;
suffices = map (x: if x ? suffix then x.suffix else "none") contents;
# For obtaining the closure of `contents'.
# Note: we don't use closureInfo yet, as that won't build with nix-1.x.
# See #36268.
exportReferencesGraph = lib.zipListsWith (x: i: [
("closure-${toValidStoreName (baseNameOf x.symlink)}-${toString i}")
x.object
]) contents (lib.range 0 (lib.length contents - 1));
pathsFromGraph = ./paths-from-graph.pl;
closureInfo = "${pkgsBuildHost.closureInfo { rootPaths = objects; }}";
}
// lib.optionalAttrs makeUInitrd {
uInitrdCompression = uInitrdCompression;

View File

@@ -24,7 +24,7 @@ done
# Get the paths in the closure of `object'.
storePaths=$(perl $pathsFromGraph closure-*)
storePaths="$(cat $closureInfo/store-paths)"
# Paths in cpio archives *must* be relative, otherwise the kernel

View File

@@ -1,68 +0,0 @@
# NOTE: this script is deprecated. Use closureInfo instead.
# Parses a /nix/store/*-closure file and prints
# various information.
# By default, the nodes in the graph are printed to stdout.
# If printRegistration is set, then the graph is written
# as a registration file for a manifest is written
# in the `nix-store --load-db' format.
use strict;
use File::Basename;
my %storePaths;
my %refs;
# Each argument on the command line is a graph file.
# The graph file contains line-triples and a variable
# number of references:
# <store-path>
# <deriver>
# <count>
# <ref-#1>
# ...
# <ref-#count>
foreach my $graph (@ARGV) {
open GRAPH, "<$graph" or die;
while (<GRAPH>) {
chomp;
my $storePath = "$_";
$storePaths{$storePath} = 1;
my $deriver = <GRAPH>; chomp $deriver;
my $count = <GRAPH>; chomp $count;
my @refs = ();
for (my $i = 0; $i < $count; ++$i) {
my $ref = <GRAPH>; chomp $ref;
push @refs, $ref;
}
$refs{$storePath} = \@refs;
}
close GRAPH;
}
if ($ENV{"printRegistration"} eq "1") {
# This is the format used by `nix-store --register-validity
# --hash-given' / `nix-store --load-db'.
foreach my $storePath (sort (keys %storePaths)) {
print "$storePath\n";
print "0000000000000000000000000000000000000000000000000000000000000000\n"; # !!! fix
print "0\n"; # !!! fix
print "\n"; # don't care about preserving the deriver
print scalar(@{$refs{$storePath}}), "\n";
foreach my $ref (@{$refs{$storePath}}) {
print "$ref\n";
}
}
}
else {
foreach my $storePath (sort (keys %storePaths)) {
print "$storePath\n";
}
}

View File

@@ -1152,6 +1152,7 @@ mapAliases {
panopticon = throw "'panopticon' has been removed because it is unmaintained upstream"; # Added 2025-01-25
paperoni = throw "paperoni has been removed, because it is unmaintained"; # Added 2024-07-14
paperless = throw "'paperless' has been renamed to/replaced by 'paperless-ngx'"; # Converted to throw 2024-10-17
pathsFromGraph = throw "pathsFromGraph has been removed, use closureInfo instead";# Added 2025-01-23
paperless-ng = paperless-ngx; # Added 2022-04-11
partition-manager = makePlasma5Throw "partitionmanager"; # Added 2024-01-08
patchelfStable = patchelf; # Added 2024-01-25

View File

@@ -734,8 +734,6 @@ with pkgs;
callPackages ../build-support/setup-hooks/patch-rc-path-hooks { }
) patchRcPathBash patchRcPathCsh patchRcPathFish patchRcPathPosix;
pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;
pruneLibtoolFiles = makeSetupHook { name = "prune-libtool-files"; }
../build-support/setup-hooks/prune-libtool-files.sh;