diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-10-15T12·42+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-10-15T12·42+0000 |
commit | ebff82222c7b946e70e539389c0027529b6c7ad0 (patch) | |
tree | 4f3352f66c91f6f21ef47b1b07f763f4be0ffeb0 /src/normalise.cc | |
parent | 5fc71276430e8e6a4588fa54da692f81d5ada585 (diff) |
* Refactoring: move all database manipulation into store.cc.
* Removed `--query --generators'.
Diffstat (limited to 'src/normalise.cc')
-rw-r--r-- | src/normalise.cc | 53 |
1 files changed, 3 insertions, 50 deletions
diff --git a/src/normalise.cc b/src/normalise.cc index 0dfc9f8e4d12..160130d96634 100644 --- a/src/normalise.cc +++ b/src/normalise.cc @@ -2,7 +2,6 @@ #include "normalise.hh" #include "references.hh" -#include "db.hh" #include "exec.hh" #include "pathlocks.hh" #include "globals.hh" @@ -11,7 +10,7 @@ static Path useSuccessor(const Path & path) { string pathSucc; - if (nixDB.queryString(noTxn, dbSuccessors, path, pathSucc)) { + if (querySuccessor(path, pathSucc)) { debug(format("successor %1% -> %2%") % (string) path % pathSucc); return pathSucc; } else @@ -349,7 +348,8 @@ Path normaliseNixExpr(const Path & _nePath, PathSet pending) for recoverability: unregistered paths in the store can be deleted arbitrarily, while registered paths can only be deleted by running the garbage collector. */ - Transaction txn(nixDB); + Transaction txn; + createStoreTransaction(txn); for (PathSet::iterator i = ne.derivation.outputs.begin(); i != ne.derivation.outputs.end(); i++) registerValidPath(txn, *i); @@ -434,50 +434,3 @@ PathSet nixExprRequisites(const Path & nePath, paths, doneSet); return paths; } - - -#if 0 -PathSet findGenerators(const PathSet & outputs) -{ - FSIdSet ids(_ids.begin(), _ids.end()); - FSIds generators; - - /* !!! hack; for performance, we just look at the rhs of successor - mappings, since we know that those are Nix expressions. */ - - Strings sucs; - nixDB.enumTable(noTxn, dbSuccessors, sucs); - - for (Strings::iterator i = sucs.begin(); - i != sucs.end(); i++) - { - string s; - if (!nixDB.queryString(noTxn, dbSuccessors, *i, s)) continue; - FSId id = parseHash(s); - - NixExpr ne; - try { - /* !!! should substitutes be used? */ - ne = parseNixExpr(termFromId(id)); - } catch (...) { /* !!! only catch parse errors */ - continue; - } - - if (ne.type != NixExpr::neClosure) continue; - - bool okay = true; - for (ClosureElems::const_iterator i = ne.closure.elems.begin(); - i != ne.closure.elems.end(); i++) - if (ids.find(i->second.id) == ids.end()) { - okay = false; - break; - } - - if (!okay) continue; - - generators.push_back(id); - } - - return generators; -} -#endif |