1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 09:31:16 +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:
Eelco Dolstra 2011-08-31 21:11:50 +00:00
parent 5bcdc7e351
commit 93227ff65c
15 changed files with 95 additions and 89 deletions

View file

@ -381,7 +381,7 @@ static void queryInstSources(EvalState & state,
if (isDerivation(path)) {
elem.setDrvPath(path);
elem.setOutPath(findOutput(derivationFromPath(path), "out"));
elem.setOutPath(findOutput(derivationFromPath(*store, path), "out"));
if (name.size() >= drvExtension.size() &&
string(name, name.size() - drvExtension.size()) == drvExtension)
name = string(name, 0, name.size() - drvExtension.size());
@ -430,7 +430,7 @@ static void printMissing(EvalState & state, const DrvInfos & elems)
targets.insert(i->queryOutPath(state));
}
printMissing(targets);
printMissing(*store, targets);
}
@ -693,12 +693,12 @@ static void opSet(Globals & globals,
if (drv.queryDrvPath(globals.state) != "") {
PathSet paths = singleton<PathSet>(drv.queryDrvPath(globals.state));
printMissing(paths);
printMissing(*store, paths);
if (globals.dryRun) return;
store->buildDerivations(paths);
}
else {
printMissing(singleton<PathSet>(drv.queryOutPath(globals.state)));
printMissing(*store, singleton<PathSet>(drv.queryOutPath(globals.state)));
if (globals.dryRun) return;
store->ensurePath(drv.queryOutPath(globals.state));
}