about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-18T11·15+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-18T11·15+0000
commit6d493751c331e7b695f82e9c259423efa7741f59 (patch)
tree242d21388375852150fe0609384dbda14d365b76 /src/libexpr/primops.cc
parent32aac8748a1439289af6b80efe9d518e123d6cc7 (diff)
* Get --readonly-mode to work again.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 9208f0b247..b85cdbadd8 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -100,8 +100,14 @@ static Path copyAtom(EvalState & state, const Path & srcPath)
 
     Path drvPath = writeTerm(unparseStoreExpr(ne), "c");
 
+    /* !!! can we get rid of drvRoots? */
     state.drvRoots[drvPath] = ne.closure.roots;
 
+    /* Optimisation, but required in read-only mode! because in that
+       case we don't actually write store expressions, so we can't
+       read them later. */
+    state.drvHashes[drvPath] = hashDerivationModulo(state, ne);
+
     printMsg(lvlChatty, format("copied `%1%' -> closure `%2%'")
         % srcPath % drvPath);
     return drvPath;
@@ -326,6 +332,11 @@ static Expr primDerivation(EvalState & state, const ATermVector & _args)
     printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'")
         % drvName % drvPath);
 
+    /* Optimisation, but required in read-only mode! because in that
+       case we don't actually write store expressions, so we can't
+       read them later. */
+    state.drvHashes[drvPath] = hashDerivationModulo(state, ne);
+
     /* !!! assumes a single output */
     attrs.set("outPath", makeAttrRHS(makePath(toATerm(outPath)), makeNoPos()));
     attrs.set("drvPath", makeAttrRHS(makePath(toATerm(drvPath)), makeNoPos()));