* Code to check whether all referenced NARs exist.

git-svn-id: https://nixos.org/repos/nix/release/trunk/channels@34742 70bd8c7a-acb8-0310-9f0d-9cc1c95dcdbb
This commit is contained in:
Eelco Dolstra 2013-06-17 23:10:59 +00:00
parent 1720cb8877
commit 297e7999a0

View file

@ -110,18 +110,28 @@ sub mirrorStorePath {
my $pathHash = substr(basename($storePath), 0, 32);
my $narInfoFile = "$pathHash.narinfo";
print STDERR "$$: checking $narInfoFile\n";
my $get = $bucket->get_key_filename("$pathHash.narinfo", "GET");
#print STDERR "$$: checking $narInfoFile\n";
my $get = $bucket->get_key("$pathHash.narinfo", "GET");
my $narInfo;
if (defined $get) {
$narInfo = parseNARInfo($storePath, $get->{value});
#if (!defined $bucket->head_key("$narInfo->{url}", "GET")) {
# print STDERR "missing NAR $narInfo->{url}!\n";
# $bucket->delete_key("$pathHash.narinfo");
# goto recreate;
#}
$nar->{hash} = $narInfo->{fileHash};
$nar->{size} = $narInfo->{fileSize};
$nar->{narHash} = $narInfo->{narHash};
$nar->{narSize} = $narInfo->{narSize};
$nar->{compressionType} = $narInfo->{compression};
$nar->{url} = "$cacheURL/$narInfo->{url}";
} else {
recreate:
my $dstFileTmp = "/tmp/nar.$$";
my $ext;