1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +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; allReferences[path] = references;
/* For this output path, find the state references to other paths contained in it. */ /* 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; allStateReferences[path] = output_state_references;
/* For debugging, print out the referenced and unreferenced /* 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); printMsg(lvlTalkative, format("scanning for component and state references inside `%1%'") % statePath);
state_references = scanForReferences(statePath, allPaths); 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 /* 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); else throw Error(format("unknown file type: %1%") % path);
} }
PathSet scanForReferences(const string & path, const PathSet & paths) PathSet scanForReferences(const string & path, const PathSet & paths)
{ {
return scanForReferencesTxn(noTxn, path, paths); return scanForReferencesTxn(noTxn, path, paths);
} }
PathSet scanForReferencesTxn(const Transaction & txn, const Path & path, const PathSet & 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; std::map<string, Path> backMap;
StringSet ids; StringSet ids;
@ -156,16 +179,8 @@ PathSet scanForReferencesTxn(const Transaction & txn, const Path & path, const P
found.insert(j->second); 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; return found;
} }
} }

View file

@ -6,10 +6,17 @@
namespace nix { namespace nix {
/* Scans for Component References (currently doesnt add solid dependencys) */
PathSet scanForReferences(const Path & path, const PathSet & refs); PathSet scanForReferences(const Path & path, const PathSet & refs);
PathSet scanForReferencesTxn(const Transaction & txn, 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 */ #endif /* !__REFERENCES_H */

View file

@ -310,8 +310,8 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa
//TODO maybe only scan in the changeset (patch) for new references? (this will be difficult and depending on the underlying versioning system) //TODO maybe only scan in the changeset (patch) for new references? (this will be difficult and depending on the underlying versioning system)
//Scan in for (new) component and state references //Scan in for (new) component and state references
PathSet state_references = scanForReferences(statePath, allComponentPaths2); //TODO PathSet state_references = scanForReferences(statePath, allComponentPaths2);
PathSet state_stateReferences = scanForReferences(statePath, allStatePaths); PathSet state_stateReferences = scanForStateReferences(statePath, allStatePaths);
//Retrieve old references //Retrieve old references
PathSet old_references; PathSet old_references;