From b7654ab716f0909b92f2e02bd91dac7ce7b895ee Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Mon, 9 Jul 2007 14:30:57 +0000 Subject: [PATCH] before removing isStateComponentTxn --- src/libstore/db.cc | 8 +- src/libstore/db.hh | 8 +- src/libstore/local-store.cc | 145 +++++++++++++++++++---------------- src/libstore/local-store.hh | 8 +- src/libstore/remote-store.cc | 20 +++-- src/libstore/remote-store.hh | 8 +- src/libstore/store-api.hh | 10 ++- src/nix-state/nix-state.cc | 38 ++++++--- src/nix-store/dotgraph.cc | 9 ++- src/nix-store/nix-store.cc | 8 +- 10 files changed, 151 insertions(+), 111 deletions(-) diff --git a/src/libstore/db.cc b/src/libstore/db.cc index 40bfcb897..995584149 100644 --- a/src/libstore/db.cc +++ b/src/libstore/db.cc @@ -466,7 +466,7 @@ void Database::splitStatePathRevision(const Path & revisionedStatePath, Path & s int Database::getNewRevisionNumber(const Transaction & txn, TableId table, - const Path & statePath) + const Path & statePath, bool update) { //query string data; @@ -482,8 +482,10 @@ int Database::getNewRevisionNumber(const Transaction & txn, TableId table, if(!succeed) throw Error(format("Malformed revision counter value of path '%1%'") % statePath); - revision++; - setString(txn, table, statePath, int2String(revision)); + if(update){ + revision++; + setString(txn, table, statePath, int2String(revision)); + } return revision; } diff --git a/src/libstore/db.hh b/src/libstore/db.hh index cb0089816..c267e3018 100644 --- a/src/libstore/db.hh +++ b/src/libstore/db.hh @@ -63,10 +63,6 @@ private: /* TODO */ bool lookupHighestRevivison(const Strings & keys, const Path & statePath, string & key, int lowerthan = -1); - /* TODO */ - int getNewRevisionNumber(const Transaction & txn, TableId table, const Path & statePath); - - public: Database(); ~Database(); @@ -126,6 +122,10 @@ public: /* Returns all available revision numbers of the given state path */ bool queryAvailableStateRevisions(const Transaction & txn, TableId table, const Path & statePath, RevisionNumbers & revisions); + + /* TODO */ + int getNewRevisionNumber(const Transaction & txn, TableId table, const Path & statePath, bool update = true); + }; diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index b10e47273..b405a123d 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -532,7 +532,7 @@ void setReferences(const Transaction & txn, const Path & store_or_statePath, } -void queryReferences(const Transaction & txn, +void queryReferencesTxn(const Transaction & txn, const Path & store_or_statePath, PathSet & references, const int revision) { Paths references2; @@ -551,10 +551,10 @@ void queryReferences(const Transaction & txn, void LocalStore::queryReferences(const Path & storePath, PathSet & references, const int revision) { - nix::queryReferences(noTxn, storePath, references, revision); + nix::queryReferencesTxn(noTxn, storePath, references, revision); } -void queryStateReferences(const Transaction & txn, +void queryStateReferencesTxn(const Transaction & txn, const Path & store_or_statePath, PathSet & stateReferences, const int revision) { Paths stateReferences2; @@ -571,7 +571,22 @@ void queryStateReferences(const Transaction & txn, void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet & stateReferences, const int revision) { - nix::queryStateReferences(noTxn, componentOrstatePath, stateReferences, revision); + nix::queryStateReferencesTxn(noTxn, componentOrstatePath, stateReferences, revision); +} + +void queryAllReferencesTxn(const Transaction & txn, const Path & path, PathSet & allReferences, const int revision) +{ + PathSet references; + PathSet stateReferences; + queryReferencesTxn(txn, path, references, revision); + queryStateReferencesTxn(txn, path, stateReferences, revision); + allReferences = pathSets_union(references, stateReferences); +} + +//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!! make 1 function with 2 bools (component=t/f state=t/f) and 3 Pathsets (component, state, all) +void LocalStore::queryAllReferences(const Path & path, PathSet & allReferences, const int revision) +{ + queryAllReferencesTxn(noTxn, path, allReferences, revision); } void queryReferrers(const Transaction & txn, @@ -649,16 +664,21 @@ void addStateDeriver(const Transaction & txn, const Path & storePath, const Path } -bool isStateComponentTxn(const Transaction & txn, const Path & storePath) + +//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! remove this entire function, replace by isValidStatePathTxn +bool isStateComponentTxn(const Transaction & txn, const Path & statePath) { - isValidPathTxn(txn, storePath); + //return isValidStatePathTxn(txn, statePath); + + string data; - return nixDB.queryString(txn, dbStateInfo, storePath, data); + return nixDB.queryString(txn, dbStateInfo, statePath, data); + } -bool LocalStore::isStateComponent(const Path & storePath) +bool LocalStore::isStateComponent(const Path & statePath) { - return nix::isStateComponentTxn(noTxn, storePath); + return nix::isStateComponentTxn(noTxn, statePath); } @@ -1128,7 +1148,7 @@ void LocalStore::exportPath(const Path & path, bool sign, writeString(path, hashAndWriteSink); PathSet references; - nix::queryReferences(txn, path, references, -1); //TODO we can only now export the final revision + nix::queryReferencesTxn(txn, path, references, -1); //TODO we can only now export the final revision writeStringSet(references, hashAndWriteSink); Path deriver = queryDeriver(txn, path); @@ -1410,7 +1430,7 @@ void verifyStore(bool checkContents) else { bool isValid = validPaths.find(*i) != validPaths.end(); PathSet references; - queryReferences(txn, *i, references, -1); //TODO + queryReferencesTxn(txn, *i, references, -1); //TODO for (PathSet::iterator j = references.begin(); j != references.end(); ++j) { @@ -1459,10 +1479,10 @@ void verifyStore(bool checkContents) else { PathSet references; - queryReferences(txn, from, references, -1); //TODO + queryReferencesTxn(txn, from, references, -1); //TODO PathSet stateReferences; //already a stateReferrers here! - queryStateReferences(txn, from, stateReferences, -1); //TODO CHECK FOR ALL REVISIONS ! + queryStateReferencesTxn(txn, from, stateReferences, -1); //TODO CHECK FOR ALL REVISIONS ! if (find(references.begin(), references.end(), to) == references.end()) { printMsg(lvlError, format("adding missing referrer mapping from `%1%' to `%2%'") % from % to); @@ -1508,11 +1528,9 @@ void LocalStore::setStatePathsInterval(const PathSet & statePaths, const vector< nix::setStatePathsInterval(statePaths, intervals, allZero); } -vector getStatePathsInterval(const PathSet & statePaths) +vector getStatePathsIntervalTxn(const Transaction & txn, const PathSet & statePaths) { - Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ... - string data; Paths referers; @@ -1531,14 +1549,13 @@ vector getStatePathsInterval(const PathSet & statePaths) intervals.push_back(n); } - txn.commit(); return intervals; } vector LocalStore::getStatePathsInterval(const PathSet & statePaths) { - return nix::getStatePathsInterval(statePaths); + return nix::getStatePathsIntervalTxn(noTxn, statePaths); } @@ -1671,11 +1688,11 @@ void getDependenciesAtBuildTime(const Transaction & txn, const Path & drvPath) //TODO include this call in the validate function //TODO ONLY CALL THIS FUNCTION ON A NON-SHARED STATE PATH!!!!!!!!!!! void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePath - , PathSet & newFoundComponentReferences, PathSet & newFoundStateReferences) //only for recursion + , PathSet & newFoundComponentReferences, PathSet & newFoundStateReferences, const int revision) //only for recursion { //Check if is a state Path if(! isStateComponentTxn(txn, statePath)) - throw Error(format("This path '%1%' is not a state path") % statePath); + throw Error(format("This path '%1%' is not a state path 1") % statePath); //TODO check if path is not a shared path ! //TODO @@ -1718,8 +1735,8 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa //Retrieve old references PathSet old_references; PathSet old_state_references; - queryReferences(txn, statePath, old_references, -1); //get the latsest references - queryStateReferences(txn, statePath, old_state_references, -1); + queryReferencesTxn(txn, statePath, old_references, -1); //get the latsest references + queryStateReferencesTxn(txn, statePath, old_state_references, -1); //Check for added and removed paths PathSet diff_references_removed; @@ -1746,30 +1763,7 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa for (PathSet::iterator i = diff_state_references_added.begin(); i != diff_state_references_added.end(); ++i) printMsg(lvlError, format("Added state reference found!: '%1%' in state path '%2%'") % (*i) % statePath); - //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - /* - Register Valid again if neccesary - - Update the 2 references tables: all state paths get: Path statepath --> List(int revnumber, List(References)) - TODO EDIT TABLES references,references_state,referrers,referrers_state - - New table stateRevisionClosure: Path StatePath + int revision --> List(int revnumbers) - - A1(STATEPATH) --> UPDATE ALL STATE REFERENCES IN DB (TRANSACTION) - A2(STATEPATH [+ REV]) --> GIVE ALL STATE REFERENCES IN DB - - B1(STATEPATH) --> SCAN ALL REFERENCES IN DB, LINK TO REVISION NUMBERS (WITH CALL TO A2) (TRANSACTION) - B2(STATEPATH [+ REV]) --> GIVES ALL REFERENCES - - - - //update all revision numbers (transaction) NEW FUN THAT UPDATES THE REVISIONS - //update all revision numbers + references (transaction) - //update all references - */ - - /* + //Finally register the paths valid with a new revision number if(diff_references_added.size() != 0 || diff_state_references_added.size() != 0){ printMsg(lvlError, format("Updating new references for statepath: '%1%'")% statePath); Path drvPath = queryStatePathDrv(txn, statePath); @@ -1778,18 +1772,12 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa Hash(), //emtpy hash state_references, state_stateReferences, - drvPath - ); - }*/ + drvPath, + revision); + } } -void LocalStore::scanAndUpdateAllReferences(const Path & statePath) -{ - PathSet empty; - return nix::scanAndUpdateAllReferencesTxn(noTxn, statePath, empty, empty); -} - -void scanAndUpdateAllReferencesRecusively(const Transaction & txn, const Path & storeOrStatePath) //TODO Can also work for statePaths??? +void scanAndUpdateAllReferencesRecusively(const Transaction & txn, const Path & storeOrStatePath, const int revision) //TODO Can also work for statePaths??? { //get all state current state references recursively PathSet statePaths; @@ -1801,48 +1789,71 @@ void scanAndUpdateAllReferencesRecusively(const Transaction & txn, const Path & //Scan, update, call recursively PathSet newFoundComponentReferences; PathSet newFoundStateReferences; - scanAndUpdateAllReferencesTxn(txn, *i, newFoundComponentReferences, newFoundStateReferences); + scanAndUpdateAllReferencesTxn(txn, *i, newFoundComponentReferences, newFoundStateReferences, revision); PathSet allNewReferences = pathSets_union(newFoundComponentReferences, newFoundStateReferences); //Call the function recursively again on all newly found references //TODO test if this doesnt go into an infinite loop for (PathSet::iterator j = allNewReferences.begin(); j != allNewReferences.end(); ++j) - scanAndUpdateAllReferencesRecusively(txn, *j); + scanAndUpdateAllReferencesRecusively(txn, *j, revision); } } -void LocalStore::scanAndUpdateAllReferencesRecusively(const Path & storeOrStatePath) +void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & storeOrStatePath, const int revision, bool recursive) { - return nix::scanAndUpdateAllReferencesRecusively(noTxn, storeOrStatePath); + if(recursive) + nix::scanAndUpdateAllReferencesRecusively(txn, storeOrStatePath, revision); + else{ + + //TODO check if storeOrStatePath is a statePath, else throw error + + PathSet empty; + nix::scanAndUpdateAllReferencesTxn(txn, storeOrStatePath, empty, empty, revision); + } } -void setStateRevisions(const Transaction & txn, const Path & statePath, const RevisionNumbersSet & revisions, const int revision) +void LocalStore::scanAndUpdateAllReferences(const Path & storeOrStatePath, const int revision, bool recursive) +{ + nix::scanAndUpdateAllReferencesTxn(noTxn, storeOrStatePath, revision, recursive); +} + +void setStateRevisionsTxn(const Transaction & txn, const Path & statePath, const RevisionNumbersSet & revisions, const int revision) { nixDB.setStateRevisions(txn, dbStateRevisions, statePath, revisions, revision); } void LocalStore::setStateRevisions(const Path & statePath, const RevisionNumbersSet & revisions, const int revision) { - nix::setStateRevisions(noTxn, statePath, revisions, revision); + nix::setStateRevisionsTxn(noTxn, statePath, revisions, revision); } -bool queryStateRevisions(const Transaction & txn, const Path & statePath, RevisionNumbers & revisions, const int revision) +bool queryStateRevisionsTxn(const Transaction & txn, const Path & statePath, RevisionNumbers & revisions, const int revision) { return nixDB.queryStateRevisions(txn, dbStateRevisions, statePath, revisions, revision); } bool LocalStore::queryStateRevisions(const Path & statePath, RevisionNumbers & revisions, const int revision) { - return nix::queryStateRevisions(noTxn, statePath, revisions, revision); + return nix::queryStateRevisionsTxn(noTxn, statePath, revisions, revision); } -bool queryAvailableStateRevisions(const Transaction & txn, const Path & statePath, RevisionNumbers & revisions) +bool queryAvailableStateRevisionsTxn(const Transaction & txn, const Path & statePath, RevisionNumbers & revisions) { return nixDB.queryAvailableStateRevisions(txn, dbStateRevisions, statePath, revisions); } bool LocalStore::queryAvailableStateRevisions(const Path & statePath, RevisionNumbers & revisions) { - return nix::queryAvailableStateRevisions(noTxn, statePath, revisions); + return nix::queryAvailableStateRevisionsTxn(noTxn, statePath, revisions); +} + +int getNewRevisionNumberTxn(const Transaction & txn, const Path & statePath, const bool update) +{ + return nixDB.getNewRevisionNumber(txn, dbStateRevisions, statePath, update); +} + +int LocalStore::getNewRevisionNumber(const Path & statePath, bool update) +{ + return nix::getNewRevisionNumberTxn(noTxn, statePath, update); } @@ -1916,7 +1927,7 @@ static void upgradeStore07() } PathSet prevReferences; - queryReferences(txn, path, prevReferences, -1); + queryReferencesTxn(txn, path, prevReferences, -1); if (prevReferences.size() > 0 && references != prevReferences) printMsg(lvlError, format("warning: conflicting references for `%1%'") % path); diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 6b81cfcef..7cf188b6e 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -55,6 +55,8 @@ public: void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision); + void queryAllReferences(const Path & path, PathSet & allReferences, const int revision); + void queryReferrers(const Path & path, PathSet & referrers, const int revision); void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision); @@ -98,9 +100,7 @@ public: void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision); - void scanAndUpdateAllReferences(const Path & statePath); - - void scanAndUpdateAllReferencesRecusively(const Path & storeOrstatePath); + void scanAndUpdateAllReferences(const Path & statePath, const int revision, bool recursive); void setStateRevisions(const Path & statePath, const RevisionNumbersSet & revisions, const int revision); @@ -108,6 +108,8 @@ public: bool queryAvailableStateRevisions(const Path & statePath, RevisionNumbers & revisions); + int getNewRevisionNumber(const Path & statePath, bool update = true); + }; diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index be400cc61..5d310ac0f 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -238,6 +238,12 @@ void RemoteStore::queryStateReferences(const Path & path, } +void RemoteStore::queryAllReferences(const Path & path, + PathSet & allReferences, const int revision) +{ + //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +} void RemoteStore::queryReferrers(const Path & path, PathSet & referrers, const int revision) @@ -463,13 +469,7 @@ void RemoteStore::storePathRequisites(const Path & storeOrstatePath, const bool } //TODO -void RemoteStore::scanAndUpdateAllReferences(const Path & statePath) -{ - -} - -//TODO -void RemoteStore::scanAndUpdateAllReferencesRecusively(const Path & storeOrstatePath) +void RemoteStore::scanAndUpdateAllReferences(const Path & statePath, const int revision, bool recursive) { } @@ -492,4 +492,10 @@ bool RemoteStore::queryAvailableStateRevisions(const Path & statePath, RevisionN return false; } +//TODO +int RemoteStore::getNewRevisionNumber(const Path & statePath, bool update) +{ + return 0; +} + } diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index 25e82235f..e49903ec6 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -43,6 +43,8 @@ public: void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision); + void queryAllReferences(const Path & path, PathSet & allReferences, const int revision); + void queryReferrers(const Path & path, PathSet & referrers, const int revision); void queryStateReferrers(const Path & path, PathSet & stateReferrers, const int revision); @@ -86,15 +88,15 @@ public: void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision); - void scanAndUpdateAllReferences(const Path & statePath); - - void scanAndUpdateAllReferencesRecusively(const Path & storeOrstatePath); + void scanAndUpdateAllReferences(const Path & statePath, const int revision, bool recursive); void setStateRevisions(const Path & statePath, const RevisionNumbersSet & revisions, const int revision); bool queryStateRevisions(const Path & statePath, RevisionNumbers & revisions, const int revision); bool queryAvailableStateRevisions(const Path & statePath, RevisionNumbers & revisions); + + int getNewRevisionNumber(const Path & statePath, bool update = true); private: AutoCloseFD fdSocket; diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 64c0a1d18..270865285 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -87,6 +87,8 @@ public: The result is not cleared. */ virtual void queryStateReferences(const Path & storePath, PathSet & stateReferences, const int revision) = 0; + virtual void queryAllReferences(const Path & path, PathSet & allReferences, const int revision) = 0; + /* Queries the set of incoming FS references for a store path. The result is not cleared. */ virtual void queryReferrers(const Path & path, @@ -218,10 +220,7 @@ public: virtual void storePathRequisites(const Path & storeOrstatePath, const bool includeOutputs, PathSet & paths, const bool & withComponents, const bool & withState, const int revision) = 0; /* TODO */ - virtual void scanAndUpdateAllReferences(const Path & statePath) = 0; - - /* TODO */ - virtual void scanAndUpdateAllReferencesRecusively(const Path & storeOrstatePath) = 0; + virtual void scanAndUpdateAllReferences(const Path & statePath, const int revision, bool recursive) = 0; /* TODO */ virtual void setStateRevisions(const Path & statePath, const RevisionNumbersSet & revisions, const int revision) = 0; @@ -231,6 +230,9 @@ public: /* TODO */ virtual bool queryAvailableStateRevisions(const Path & statePath, RevisionNumbers & revisions) = 0; + + /* TODO */ + virtual int getNewRevisionNumber(const Path & statePath, bool update = true) = 0; }; diff --git a/src/nix-state/nix-state.cc b/src/nix-state/nix-state.cc index 27e3a4afa..9070ba9a1 100644 --- a/src/nix-state/nix-state.cc +++ b/src/nix-state/nix-state.cc @@ -10,7 +10,6 @@ #include "help.txt.hh" #include "local-store.hh" #include "derivations.hh" -#include "store-api.hh" //TODO REMOVE using namespace nix; using std::cin; @@ -23,6 +22,7 @@ typedef void (* Operation) (Strings opFlags, Strings opArgs); string stateIdentifier; string username; int revision_arg; +bool scanforReferences = false; /************************* Build time Functions ******************************/ @@ -346,7 +346,8 @@ static void opRunComponent(Strings opFlags, Strings opArgs) //******************* With everything in place, we call the commit script on all statePaths ********************** - RevisionNumbersSet rivisionMapping; + PathSet statePaths; + RevisionNumbersSet rivisionMapping; for (PathSet::iterator d = root_drvs.begin(); d != root_drvs.end(); ++d) //TODO first commit own state path? { @@ -378,7 +379,7 @@ static void opRunComponent(Strings opFlags, Strings opArgs) intervalPaths.insert(fullstatedir); } } - vector intervals = store->getStatePathsInterval(intervalPaths); + vector intervals = store->getStatePathsInterval(intervalPaths); //TODO !!!!!!!!!!!!! txn ?? int intervalAt=0; for (DerivationStateOutputDirs::const_reverse_iterator i = stateOutputDirs.rbegin(); i != stateOutputDirs.rend(); ++i){ @@ -446,22 +447,33 @@ static void opRunComponent(Strings opFlags, Strings opArgs) runProgram_AndPrintOutput(nixLibexecDir + "/nix/nix-statecommit.sh", true, p_args, "svn"); //Update the intervals again - //store->setStatePathsInterval(intervalPaths, intervals); //TODO!!!!!!!!!!!!!!!!!!!!!! uncomment + //store->setStatePathsInterval(intervalPaths, intervals); //TODO!!!!!!!!!!!!!!!!!!!!!! uncomment and txn ?? - //TODO - //Scan if needed //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! needs a new revision number - if(false) - store->scanAndUpdateAllReferencesRecusively(statePath); - + statePaths.insert(statePath); //Insert StatePath rivisionMapping[statePath] = readRevisionNumber(drv); //Get current numbers } - //Store the revision numbers in the database for this statePath to a new revision - store->setStateRevisions(root_statePath, rivisionMapping, -1); + //1.NEW TRANSACTION + //TODO + + //Get new revision number + int newRevisionNumber = store->getNewRevisionNumber(root_statePath); + //Scan for new references, and update with revision number + if(scanforReferences){ + for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i) + store->scanAndUpdateAllReferences(*i, newRevisionNumber, true); + } + + //Store the revision numbers in the database for this statePath with revision number + store->setStateRevisions(root_statePath, rivisionMapping, newRevisionNumber); + + //4. COMMIT + //TODO + + //Debugging RevisionNumbers getRivisions; bool b = store->queryStateRevisions(root_statePath, getRivisions, -1); - for (RevisionNumbers::iterator i = getRivisions.begin(); i != getRivisions.end(); ++i){ printMsg(lvlError, format("REV %1%") % int2String(*i)); } @@ -629,6 +641,8 @@ void run(Strings args) */ + else if (arg == "--scanreferences") + scanforReferences = true; else if (arg.substr(0,13) == "--identifier=") stateIdentifier = arg.substr(13,arg.length()); else if (arg.substr(0,7) == "--user=") diff --git a/src/nix-store/dotgraph.cc b/src/nix-store/dotgraph.cc index 674c174f5..1b4910a20 100644 --- a/src/nix-store/dotgraph.cc +++ b/src/nix-store/dotgraph.cc @@ -111,11 +111,12 @@ void printDotGraph(const PathSet & roots) cout << makeNode(path, symbolicName(path), "#ff0000"); - PathSet references; - store->queryReferences(path, references, -1); //TODO maybe also include state paths? + PathSet allReferences; + store->queryAllReferences(path, allReferences, -1); + - for (PathSet::iterator i = references.begin(); - i != references.end(); ++i) + for (PathSet::iterator i = allReferences.begin(); + i != allReferences.end(); ++i) { if (*i != path) { workList.insert(*i); diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index b01c37d84..35e79bffd 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -211,8 +211,8 @@ static void printTree(const Path & path, cout << format("%1%%2%\n") % firstPad % path; - PathSet references; - store->queryReferences(path, references, -1); //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Adjust printTree, include state paths! + PathSet allReferences; + store->queryAllReferences(path, allReferences, -1); #if 0 for (PathSet::iterator i = drv.inputSrcs.begin(); @@ -224,7 +224,7 @@ static void printTree(const Path & path, closure(B). That is, if derivation A is an (possibly indirect) input of B, then A is printed first. This has the effect of flattening the tree, preventing deeply nested structures. */ - Paths sorted = topoSortPaths(references); + Paths sorted = topoSortPaths(allReferences); reverse(sorted.begin(), sorted.end()); for (Paths::iterator i = sorted.begin(); i != sorted.end(); ++i) { @@ -362,7 +362,7 @@ static void opQuery(Strings opFlags, Strings opArgs) } break; - case qTree: { //TODO include state path? + case qTree: { PathSet done; for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i)