Author: eelco
Date: Thu Feb 17 13:26:33 2011
New Revision: 26010
URL: https://svn.nixos.org/websvn/nix/?rev=26010&sc=1

Log:
* nix-push: handle the case where the hash is not set in the DB.

Modified:
   nix/trunk/scripts/nix-push.in

Modified: nix/trunk/scripts/nix-push.in
==============================================================================
--- nix/trunk/scripts/nix-push.in       Thu Feb 17 13:00:55 2011        (r26009)
+++ nix/trunk/scripts/nix-push.in       Thu Feb 17 13:26:33 2011        (r26010)
@@ -193,6 +193,16 @@
     die "cannot query hash for `$storePath'" if $? != 0;
     chomp $narHash;
 
+    # In some exceptional cases (such as VM tests that use the Nix
+    # store of the host), the database doesn't contain the hash.  So
+    # compute it.
+    if ($narHash eq 
"sha256:0000000000000000000000000000000000000000000000000000000000000000") {
+        $narHash = `$binDir/nix-hash --type sha256 '$storePath'`;
+        die "cannot hash `$storePath'" if $? != 0;
+        chomp $narHash;
+        $narHash = "sha256:$narHash";
+    }
+
     my $narSize = `$binDir/nix-store --query --size '$storePath'`;
     die "cannot query size for `$storePath'" if $? != 0;
     chomp $narSize;
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to