diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-08-31T21·11+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-08-31T21·11+0000 |
commit | 93227ff65c73e726c4ceef0cdd9439e7a4301417 (patch) | |
tree | ba7b60ca132c373913dd4a1c42a900009aeb8a77 /src/libstore/derivations.cc | |
parent | 5bcdc7e3517e6d679cad1aaba41e4deb76d5a6e7 (diff) |
* Eliminate all uses of the global variable ‘store’ from libstore.
This should also fix: nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr<T>::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it.
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r-- | src/libstore/derivations.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index db9fc6b8a561..5a0f4ecc69e0 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -26,7 +26,8 @@ void DerivationOutput::parseHashInfo(bool & recursive, HashType & hashType, Hash } -Path writeDerivation(const Derivation & drv, const string & name) +Path writeDerivation(StoreAPI & store, + const Derivation & drv, const string & name) { PathSet references; references.insert(drv.inputSrcs.begin(), drv.inputSrcs.end()); @@ -39,7 +40,7 @@ Path writeDerivation(const Derivation & drv, const string & name) string contents = unparseDerivation(drv); return readOnlyMode ? computeStorePathForText(suffix, contents, references) - : store->addTextToStore(suffix, contents, references); + : store.addTextToStore(suffix, contents, references); } @@ -221,7 +222,7 @@ DrvHashes drvHashes; paths have been replaced by the result of a recursive call to this function, and that for fixed-output derivations we return a hash of its output path. */ -Hash hashDerivationModulo(Derivation drv) +Hash hashDerivationModulo(StoreAPI & store, Derivation drv) { /* Return a fixed hash for fixed-output derivations. */ if (isFixedOutputDrv(drv)) { @@ -238,8 +239,8 @@ Hash hashDerivationModulo(Derivation drv) foreach (DerivationInputs::const_iterator, i, drv.inputDrvs) { Hash h = drvHashes[i->first]; if (h.type == htUnknown) { - Derivation drv2 = derivationFromPath(i->first); - h = hashDerivationModulo(drv2); + Derivation drv2 = derivationFromPath(store, i->first); + h = hashDerivationModulo(store, drv2); drvHashes[i->first] = h; } inputs2[printHash(h)] = i->second; |