about summary refs log tree commit diff
path: root/src/libstore/storeexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-14T13·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-14T13·51+0000
commit9530cc31700f68fd229eee69eabd2baa099f404a (patch)
tree5cc317adeb0c8098d8a9197a0bcbcb29ee4d941d /src/libstore/storeexpr.cc
parenta7b94e87d7d28f763a708876cba46c8f2484b526 (diff)
* 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).

Diffstat (limited to 'src/libstore/storeexpr.cc')
-rw-r--r--src/libstore/storeexpr.cc16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/libstore/storeexpr.cc b/src/libstore/storeexpr.cc
index 3308d5b06dc9..de29959edf60 100644
--- a/src/libstore/storeexpr.cc
+++ b/src/libstore/storeexpr.cc
@@ -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));
 }