* Start move towards SHA-256 hashes instead of MD5.
* Start cleaning up unique store path generation (they weren't always
unique; in particular the suffix ("-aterm-2.2", "-builder.sh") was
not part of the hash, therefore changes to the suffix would cause
multiple store objects with the same hash).
This commit is contained in:
parent
a7b94e87d7
commit
9530cc3170
9 changed files with 63 additions and 34 deletions
|
|
@ -14,19 +14,9 @@ Hash hashTerm(ATerm t)
|
|||
|
||||
Path writeTerm(ATerm t, const string & suffix)
|
||||
{
|
||||
/* The id of a term is its hash. */
|
||||
Hash h = hashTerm(t);
|
||||
|
||||
Path path = canonPath(nixStore + "/" +
|
||||
(string) h + suffix + ".store");
|
||||
|
||||
if (!readOnlyMode && !isValidPath(path)) {
|
||||
char * s = ATwriteToString(t);
|
||||
if (!s) throw Error(format("cannot write aterm to `%1%'") % path);
|
||||
addTextToStore(path, string(s));
|
||||
}
|
||||
|
||||
return path;
|
||||
char * s = ATwriteToString(t);
|
||||
if (!s) throw Error("cannot print aterm");
|
||||
return addTextToStore(suffix + ".store", string(s));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue