1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Binary caches: use a better key

Use the hash part of the store path as a key rather than a hash of the
store path.  This is enough to get the desired privacy property.
This commit is contained in:
Eelco Dolstra 2012-07-02 12:42:58 -04:00
parent 6b1e671ac6
commit 6ec7460af1
2 changed files with 13 additions and 8 deletions

View file

@ -218,12 +218,12 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
}
}
my $infoName = hashString("sha256", 1, $storePath);
my $pathHash = substr(basename($storePath), 0, 32);
if ($localCopy) {
my $dst = "$localArchivesDir/$infoName.narinfo";
my $dst = "$localArchivesDir/$pathHash.narinfo";
if ($force || ! -f $dst) {
my $tmp = "$localArchivesDir/.tmp.$$.$infoName";
my $tmp = "$localArchivesDir/.tmp.$$.$pathHash.narinfo";
open INFO, ">$tmp" or die;
print INFO "$info" or die;
close INFO or die;