mirror of
https://github.com/NixOS/nix.git
synced 2025-11-25 11:49:35 +01:00
* Fix a bug that caused Fix not to be deterministic (due to addToStore
returning different paths if the hash of the path to be added was already available in the store under a different name).
This commit is contained in:
parent
c834a5c597
commit
73b163c1a1
3 changed files with 9 additions and 9 deletions
13
src/store.cc
13
src/store.cc
|
|
@ -224,24 +224,23 @@ string expandHash(const Hash & hash, const string & target,
|
|||
}
|
||||
|
||||
|
||||
void addToStore(string srcPath, string & dstPath, Hash & hash)
|
||||
void addToStore(string srcPath, string & dstPath, Hash & hash,
|
||||
bool deterministicName)
|
||||
{
|
||||
srcPath = absPath(srcPath);
|
||||
|
||||
hash = hashPath(srcPath);
|
||||
|
||||
string baseName = baseNameOf(srcPath);
|
||||
dstPath = canonPath(nixStore + "/" + (string) hash + "-" + baseName);
|
||||
|
||||
try {
|
||||
/* !!! should not use the substitutes! */
|
||||
dstPath = expandHash(hash, "", nixStore);
|
||||
dstPath = expandHash(hash, deterministicName ? dstPath : "", nixStore);
|
||||
return;
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
string baseName = baseNameOf(srcPath);
|
||||
dstPath = canonPath(nixStore + "/" + (string) hash + "-" + baseName);
|
||||
|
||||
copyPath(srcPath, dstPath);
|
||||
|
||||
registerPath(dstPath, hash);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue