aboutsummaryrefslogtreecommitdiff
path: root/scripts/nix-push.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-03-14 15:09:53 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-03-14 15:09:53 +0000
commit8eff18cd4321f6282e3880da09010ccc9242962e (patch)
tree179ffe1cd9d27b43e6cd2ce60e348d5f116d609c /scripts/nix-push.in
parent1562dfe9bad119e58296f35c1982fc539a97ac30 (diff)
* Set NAR name to content hash; previous nix-push names were not
unique. * Drop `hashAlgo' attribute in manifests; prefix hashes with the hash algorithm instead.
Diffstat (limited to 'scripts/nix-push.in')
-rw-r--r--scripts/nix-push.in21
1 files changed, 10 insertions, 11 deletions
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index 5f5f659b6..ecc7a77af 100644
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -148,12 +148,6 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
my $basename = $1;
defined $basename or die;
- my $narname = "$basename.nar.bz2";
-
- my $narFile = "$narDir/$narname";
- (-f $narFile) or die "narfile for $storePath not found";
- push @narArchives, $narFile;
-
open SHA1, "$narDir/narbz2-hash" or die "cannot open narbz2-hash";
my $narbz2Hash = <SHA1>;
chomp $narbz2Hash;
@@ -166,6 +160,12 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
$narHash =~ /^[0-9a-z]{32}$/ or die "invalid hash";
close SHA1;
+ my $narName = "$narbz2Hash.nar.bz2";
+
+ my $narFile = "$narDir/$narName";
+ (-f $narFile) or die "narfile for $storePath not found";
+ push @narArchives, $narFile;
+
my $narbz2Size = (stat $narFile)[7];
my $references = `$binDir/nix-store --query --references '$storePath'`;
@@ -179,16 +179,15 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
my $url;
if ($localCopy) {
- $url = "file://$localArchivesDir/$narname";
+ $url = "file://$localArchivesDir/$narName";
} else {
- $url = "$archivesGetURL/$narname";
+ $url = "$archivesGetURL/$narName";
}
$narFiles{$storePath} = [
{ url => $url
- , hash => $narbz2Hash
+ , hash => "sha1:$narbz2Hash"
, size => $narbz2Size
- , narHash => $narHash
- , hashAlgo => "sha1"
+ , narHash => "sha1:$narHash"
, references => $references
, deriver => $deriver
}