diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-01-25 17:18:44 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-01-25 17:18:44 +0000 |
commit | fdcaf37361126793a1416ef5b348e5bf2f0fd1a0 (patch) | |
tree | 0e93d8cfb1f0aeabe303c9c74650d07e399c3c61 /src/libstore | |
parent | 50e34891f0e11f400bd50390ede3b7700a2b4db9 (diff) | |
download | guix-fdcaf37361126793a1416ef5b348e5bf2f0fd1a0.tar.gz |
* 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).
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/misc.cc | 11 | ||||
-rw-r--r-- | src/libstore/misc.hh | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index f2b4c7a4ee..2d7d13a0e7 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -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); } diff --git a/src/libstore/misc.hh b/src/libstore/misc.hh index f3aa34076c..0bc9a2ee0d 100644 --- a/src/libstore/misc.hh +++ b/src/libstore/misc.hh @@ -19,7 +19,8 @@ Derivation derivationFromPath(const Path & drvPath); `referrers' relation instead of the `references' relation is returned. */ void computeFSClosure(const Path & storePath, - PathSet & paths, bool flipDirection = false); + PathSet & paths, bool flipDirection = false, + bool includeOutputs = false); /* Return the path corresponding to the output identifier `id' in the given derivation. */ |