mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 05:00:58 +01:00
Before adding dbValidStatePaths
This commit is contained in:
parent
0e41b191bf
commit
51fad07fbd
13 changed files with 167 additions and 144 deletions
|
|
@ -18,6 +18,7 @@ Derivation derivationFromPath(const Path & drvPath)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
void computeFSClosure(const Path & storePath,
|
||||
PathSet & paths, bool flipDirection)
|
||||
{
|
||||
|
|
@ -30,10 +31,40 @@ void computeFSClosure(const Path & storePath,
|
|||
else
|
||||
store->queryReferences(storePath, references);
|
||||
|
||||
for (PathSet::iterator i = references.begin();
|
||||
i != references.end(); ++i)
|
||||
for (PathSet::iterator i = references.begin(); i != references.end(); ++i)
|
||||
computeFSClosure(*i, paths, flipDirection);
|
||||
}
|
||||
*/
|
||||
|
||||
void computeFSClosure(const Path & path, PathSet & paths, const bool & withState, bool flipDirection)
|
||||
{
|
||||
if (paths.find(path) != paths.end()) return;
|
||||
|
||||
paths.insert(path);
|
||||
|
||||
PathSet references;
|
||||
PathSet stateReferences;
|
||||
|
||||
if (flipDirection){
|
||||
store->queryReferrers(path, references);
|
||||
if(withState)
|
||||
store->queryStateReferrers(path, stateReferences);
|
||||
}
|
||||
else{
|
||||
store->queryReferences(path, references);
|
||||
if(withState)
|
||||
store->queryStateReferences(path, stateReferences);
|
||||
}
|
||||
|
||||
PathSet allReferences;
|
||||
if(withState)
|
||||
allReferences = mergePathSets(references, stateReferences);
|
||||
else
|
||||
allReferences = references;
|
||||
|
||||
for (PathSet::iterator i = allReferences.begin(); i != allReferences.end(); ++i)
|
||||
computeFSClosure(*i, paths, withState, flipDirection);
|
||||
}
|
||||
|
||||
|
||||
Path findOutput(const Derivation & drv, string id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue