Skip to content

Commit 96ada14

Browse files
committed
Add netboot files to channel
1 parent 0cf0276 commit 96ada14

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

mirror-nixos-branch.pl

+22-15
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,27 @@ sub fetch {
9999
}
100100

101101
sub downloadFile {
102-
my ($jobName, $dstName) = @_;
102+
my ($jobName, $dstBase) = @_;
103103

104104
my $buildInfo = decode_json(fetch("$evalUrl/job/$jobName", 'application/json'));
105105

106-
my $srcFile = $buildInfo->{buildproducts}->{1}->{path} or die "job '$jobName' lacks a store path";
107-
$dstName //= basename($srcFile);
108-
my $dstFile = "$tmpDir/" . $dstName;
109-
110-
my $sha256_expected = $buildInfo->{buildproducts}->{1}->{sha256hash} or die;
111-
112-
if (! -e $dstFile) {
113-
print STDERR "downloading $srcFile to $dstFile...\n";
114-
write_file("$dstFile.sha256", "$sha256_expected $dstName");
115-
system("NIX_REMOTE=https://cache.nixos.org/ nix cat-store '$srcFile' > '$dstFile.tmp'") == 0
116-
or die "unable to fetch $srcFile\n";
117-
rename("$dstFile.tmp", $dstFile) or die;
118-
}
106+
my $buildproducts = $buildInfo->{buildproducts};
107+
for my $product (values %$buildproducts) {
108+
my %product = %$product;
109+
my $srcFile = $product->{path} or die "job '$jobName' lacks a store path";
110+
my $dstName = $dstBase // basename($srcFile);
111+
my $dstFile = "$tmpDir/" . $dstName;
112+
113+
my $sha256_expected = $product->{sha256hash} or die "file '$srcFile' lacks an expected hash";
114+
115+
if (! -e $dstFile) {
116+
print STDERR "downloading $srcFile to $dstFile...\n";
117+
write_file("$dstFile.sha256", "$sha256_expected $dstName\n");
118+
system("NIX_REMOTE=https://cache.nixos.org/ nix cat-store '$srcFile' > '$dstFile.tmp'") == 0
119+
or die "unable to fetch $srcFile\n";
120+
rename("$dstFile.tmp", $dstFile) or die;
121+
}
119122

120-
if (-e "$dstFile.sha256") {
121123
my $sha256_actual = `nix hash-file --type sha256 '$dstFile'`;
122124
chomp $sha256_actual;
123125
if ($sha256_expected ne $sha256_actual) {
@@ -137,6 +139,11 @@ sub fetch {
137139
#downloadFile("nixos.iso_graphical.i686-linux");
138140
downloadFile("nixos.ova.x86_64-linux");
139141
#downloadFile("nixos.ova.i686-linux");
142+
# Netboot is currently not included in -small but maybe should be?
143+
# This may fail because of nixos/hydra#580, hence wrapping in eval
144+
# nixos/nixpkgs#44089 works around it, but is not backported to all channels.
145+
eval { downloadFile("nixos.netboot.x86_64-linux"); };
146+
warn "Could not download netboot files: $@" if $@;
140147
}
141148

142149
} else {

0 commit comments

Comments
 (0)