mirror of
https://github.com/NixOS/nix
synced 2025-06-29 10:31:15 +02:00
* 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.
This commit is contained in:
parent
5bcdc7e351
commit
93227ff65c
15 changed files with 95 additions and 89 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue