* Replace read-only calls to addTextToStore.
This commit is contained in:
parent
a824d58b56
commit
fcd9900d74
2 changed files with 9 additions and 3 deletions
|
@ -389,7 +389,9 @@ static Expr primToFile(EvalState & state, const ATermVector & args)
|
||||||
refs.insert(*i);
|
refs.insert(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Path storePath = store->addTextToStore(name, contents, refs);
|
Path storePath = readOnlyMode
|
||||||
|
? computeStorePathForText(name, contents)
|
||||||
|
: store->addTextToStore(name, contents, refs);
|
||||||
|
|
||||||
/* Note: we don't need to add `context' to the context of the
|
/* Note: we don't need to add `context' to the context of the
|
||||||
result, since `storePath' itself has references to the paths
|
result, since `storePath' itself has references to the paths
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
#include "aterm.hh"
|
#include "aterm.hh"
|
||||||
|
#include "globals.hh"
|
||||||
|
|
||||||
#include "derivations-ast.hh"
|
#include "derivations-ast.hh"
|
||||||
#include "derivations-ast.cc"
|
#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
|
/* Note that the outputs of a derivation are *not* references
|
||||||
(that can be missing (of course) and should not necessarily be
|
(that can be missing (of course) and should not necessarily be
|
||||||
held during a garbage collection). */
|
held during a garbage collection). */
|
||||||
return store->addTextToStore(name + drvExtension,
|
string suffix = name + drvExtension;
|
||||||
atPrint(unparseDerivation(drv)), references);
|
string contents = atPrint(unparseDerivation(drv));
|
||||||
|
return readOnlyMode
|
||||||
|
? computeStorePathForText(suffix, contents)
|
||||||
|
: store->addTextToStore(suffix, contents, references);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue