From 93227ff65c73e726c4ceef0cdd9439e7a4301417 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 31 Aug 2011 21:11:50 +0000 Subject: =?UTF-8?q?*=20Eliminate=20all=20uses=20of=20the=20global=20variab?= =?UTF-8?q?le=20=E2=80=98store=E2=80=99=20from=20libstore.=20=20=20This=20?= =?UTF-8?q?should=20also=20fix:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr::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. --- src/libstore/derivations.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libstore/derivations.cc') diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index db9fc6b8a..5a0f4ecc6 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; -- cgit v1.2.3