about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-11-17T12·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-11-17T12·51+0000
commit5693b8a7e246af352c26c258e2af6402601839ed (patch)
tree225b907281da5b185b0a44342ebf62205a58f98b /scripts
parente60c962fb8dd3d8be37c1f4ae08d5247901fa129 (diff)
* nix-push: no need to compute the NAR hash, since the Nix database
  already has it (`nix-store -q --hash').

Diffstat (limited to 'scripts')
-rw-r--r--scripts/nix-push.in12
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index 38097f7401..c7da528b56 100644
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -172,12 +172,6 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
     $narbz2Hash =~ /^[0-9a-z]+$/ or die "invalid hash";
     close HASH;
 
-    open HASH, "$narDir/nar-hash" or die "cannot open nar-hash";
-    my $narHash = <HASH>;
-    chomp $narHash;
-    $narHash =~ /^[0-9a-z]+$/ or die "invalid hash";
-    close HASH;
-    
     my $narName = "$narbz2Hash.nar.bz2";
 
     my $narFile = "$narDir/$narName";
@@ -195,6 +189,10 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
     chomp $deriver;
     $deriver = "" if $deriver eq "unknown-deriver";
 
+    my $narHash = `$binDir/nix-store --query --hash '$storePath'`;
+    die "cannot query hash for `$storePath'" if $? != 0;
+    chomp $narHash;
+
     my $url;
     if ($localCopy) {
         $url = "$targetArchivesUrl/$narName";
@@ -205,7 +203,7 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
         { url => $url
         , hash => "$hashAlgo:$narbz2Hash"
         , size => $narbz2Size
-        , narHash => "$hashAlgo:$narHash"
+        , narHash => "$narHash"
         , references => $references
         , deriver => $deriver
         }