Record top-level store paths of each release

We need this to do garbage collection on cache.nixos.org now that
MANIFEST is gone.
This commit is contained in:
Eelco Dolstra 2016-03-03 15:59:21 +01:00
parent f7beae78eb
commit a058826231

View file

@ -8,6 +8,7 @@ use File::Path;
use File::Slurp; use File::Slurp;
use JSON::PP; use JSON::PP;
use LWP::UserAgent; use LWP::UserAgent;
use List::MoreUtils qw(uniq);
my $branch = $ARGV[0]; my $branch = $ARGV[0];
my $jobset = $ARGV[1]; my $jobset = $ARGV[1];
@ -60,13 +61,18 @@ if (-d $releaseDir) {
print STDERR "release already exists\n"; print STDERR "release already exists\n";
} else { } else {
my $tmpDir = dirname($releaseDir) . "/$releaseName-tmp"; my $tmpDir = dirname($releaseDir) . "/$releaseName-tmp";
print STDERR "$tmpDir\n";
File::Path::make_path($tmpDir); File::Path::make_path($tmpDir);
write_file("$tmpDir/src-url", $evalUrl); write_file("$tmpDir/src-url", $evalUrl);
write_file("$tmpDir/git-revision", $rev); write_file("$tmpDir/git-revision", $rev);
write_file("$tmpDir/binary-cache-url", "https://cache.nixos.org"); write_file("$tmpDir/binary-cache-url", "https://cache.nixos.org");
if (! -e "$tmpDir/store-paths.xz") {
my $storePaths = decode_json(fetch("$evalUrl/store-paths", 'application/json'));
write_file("$tmpDir/store-paths", join("\n", uniq(@{$storePaths})) . "\n");
system("xz", "$tmpDir/store-paths") == 0 or die;
}
# Copy the manual. # Copy the manual.
if (! -e "$tmpDir/manual") { if (! -e "$tmpDir/manual") {
my $manualInfo = decode_json(fetch("$evalUrl/job/nixos.manual.x86_64-linux", 'application/json')); my $manualInfo = decode_json(fetch("$evalUrl/job/nixos.manual.x86_64-linux", 'application/json'));