1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 20:20:58 +01:00
This commit is contained in:
Wouter den Breejen 2007-07-18 11:19:41 +00:00
parent c0bd494865
commit b46db4dea7
4 changed files with 37 additions and 15 deletions

View file

@ -1711,7 +1711,7 @@ void DerivationGoal::computeClosure()
allReferences[path] = references;
/* For this output path, find the state references to other paths contained in it. */
PathSet output_state_references = scanForReferences(path, allStatePaths);
PathSet output_state_references = scanForStateReferences(path, allStatePaths);
allStateReferences[path] = output_state_references;
/* For debugging, print out the referenced and unreferenced
@ -1758,7 +1758,7 @@ void DerivationGoal::computeClosure()
printMsg(lvlTalkative, format("scanning for component and state references inside `%1%'") % statePath);
state_references = scanForReferences(statePath, allPaths);
state_stateReferences = scanForReferences(statePath, allStatePaths);
state_stateReferences = scanForStateReferences(statePath, allStatePaths);
}
/* Register each output path as valid, and register the sets of

View file

@ -118,13 +118,36 @@ void checkPath(const string & path,
else throw Error(format("unknown file type: %1%") % path);
}
PathSet scanForReferences(const string & path, const PathSet & paths)
{
return scanForReferencesTxn(noTxn, path, paths);
}
PathSet scanForReferencesTxn(const Transaction & txn, const Path & path, const PathSet & paths)
{
return scanForReferencesTxn_(txn, path, paths);
}
PathSet scanForStateReferences(const string & path, const PathSet & paths)
{
return scanForStateReferencesTxn(noTxn, path, paths);
}
PathSet scanForStateReferencesTxn(const Transaction & txn, const Path & path, const PathSet & paths)
{
//Get the references from the scan
PathSet org_references = scanForReferencesTxn_(txn, path, paths);
//Get the solid state dependencies, and also insert them
PathSet solidStateDeps;
querySolidStateReferencesTxn(txn, path, solidStateDeps);
org_references.insert(solidStateDeps.begin(), solidStateDeps.end());
return org_references;
}
PathSet scanForReferencesTxn_(const Transaction & txn, const Path & path, const PathSet & paths)
{
std::map<string, Path> backMap;
StringSet ids;
@ -156,16 +179,8 @@ PathSet scanForReferencesTxn(const Transaction & txn, const Path & path, const P
found.insert(j->second);
}
//Get the solid state dependencies, and also insert them
PathSet solidStateDeps;
querySolidStateReferencesTxn(txn, path, solidStateDeps);
found.insert(solidStateDeps.begin(), solidStateDeps.end());
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! we only scan the paths, if we scan for state references, this STORE path will show up !!!!!!!!!!!!!!
//TODO Create a scanForReferencesState() funtion wrapper !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return found;
}
}

View file

@ -6,10 +6,17 @@
namespace nix {
/* Scans for Component References (currently doesnt add solid dependencys) */
PathSet scanForReferences(const Path & path, const PathSet & refs);
PathSet scanForReferencesTxn(const Transaction & txn, const Path & path, const PathSet & refs);
/* Scans for State References and adds solid state dependencys*/
PathSet scanForStateReferences(const Path & path, const PathSet & refs);
PathSet scanForStateReferencesTxn(const Transaction & txn, const Path & path, const PathSet & refs);
/* The original scanForReferences */
PathSet scanForReferencesTxn_(const Transaction & txn, const Path & path, const PathSet & refs);
}
#endif /* !__REFERENCES_H */