From fcd9900d74b0eb3d57402c448ede2a411133fa46 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Dec 2006 21:00:39 +0000 Subject: * Replace read-only calls to addTextToStore. --- src/libstore/derivations.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libstore/derivations.cc') diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index d159d47a5e4a..aea95ef31477 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -1,6 +1,7 @@ #include "derivations.hh" #include "store-api.hh" #include "aterm.hh" +#include "globals.hh" #include "derivations-ast.hh" #include "derivations-ast.cc" @@ -25,8 +26,11 @@ Path writeDerivation(const Derivation & drv, const string & name) /* Note that the outputs of a derivation are *not* references (that can be missing (of course) and should not necessarily be held during a garbage collection). */ - return store->addTextToStore(name + drvExtension, - atPrint(unparseDerivation(drv)), references); + string suffix = name + drvExtension; + string contents = atPrint(unparseDerivation(drv)); + return readOnlyMode + ? computeStorePathForText(suffix, contents) + : store->addTextToStore(suffix, contents, references); } -- cgit 1.4.1