From 6d493751c331e7b695f82e9c259423efa7741f59 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Jan 2005 11:15:50 +0000 Subject: [PATCH] * Get --readonly-mode to work again. --- src/libexpr/primops.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 9208f0b24..b85cdbadd 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()));