mirror of
https://github.com/NixOS/nix
synced 2025-06-29 02:11:15 +02:00
* Made `nix-store -qR --include-outputs' much faster if there are
multiple paths specified on the command line (from O(n * m) to O(n + m), where n is the number of arguments and m is the size of the closure).
This commit is contained in:
parent
50e34891f0
commit
fdcaf37361
3 changed files with 13 additions and 41 deletions
|
@ -19,7 +19,7 @@ Derivation derivationFromPath(const Path & drvPath)
|
|||
|
||||
|
||||
void computeFSClosure(const Path & storePath,
|
||||
PathSet & paths, bool flipDirection)
|
||||
PathSet & paths, bool flipDirection, bool includeOutputs)
|
||||
{
|
||||
if (paths.find(storePath) != paths.end()) return;
|
||||
paths.insert(storePath);
|
||||
|
@ -30,8 +30,15 @@ void computeFSClosure(const Path & storePath,
|
|||
else
|
||||
store->queryReferences(storePath, references);
|
||||
|
||||
if (includeOutputs && isDerivation(storePath)) {
|
||||
Derivation drv = derivationFromPath(storePath);
|
||||
foreach (DerivationOutputs::iterator, i, drv.outputs)
|
||||
if (store->isValidPath(i->second.path))
|
||||
computeFSClosure(i->second.path, paths, flipDirection, true);
|
||||
}
|
||||
|
||||
foreach (PathSet::iterator, i, references)
|
||||
computeFSClosure(*i, paths, flipDirection);
|
||||
computeFSClosure(*i, paths, flipDirection, includeOutputs);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue