* nix-push: handle the case where the hash is not set in the DB.
This commit is contained in:
parent
c3cee5395b
commit
e945b52a31
1 changed files with 10 additions and 0 deletions
|
@ -193,6 +193,16 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
|
||||||
die "cannot query hash for `$storePath'" if $? != 0;
|
die "cannot query hash for `$storePath'" if $? != 0;
|
||||||
chomp $narHash;
|
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'`;
|
my $narSize = `$binDir/nix-store --query --size '$storePath'`;
|
||||||
die "cannot query size for `$storePath'" if $? != 0;
|
die "cannot query size for `$storePath'" if $? != 0;
|
||||||
chomp $narSize;
|
chomp $narSize;
|
||||||
|
|
Loading…
Reference in a new issue