aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-13 13:08:27 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-13 13:08:27 -0400
commit2923b55f9d67bda340053a27e08f7bcddc025f7c (patch)
treef89ce72820e096678f0d5885ae034510ad43f3ef /src/libstore/gc.cc
parent31114ec3a5ce08ccf9526f62316f1cc60c8b399a (diff)
Delete paths in a component in topologically sorted order
The outputs of a derivation can refer to each other (even though they cannot have cycles), so they have to be deleted in the right order. http://hydra.nixos.org/build/3026118
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 0e0c15934..dc1de48ea 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -454,6 +454,7 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path)
is, we can delete the elements of ‘paths’ only if all referrers
of ‘paths’ are garbage. */
PathSet paths, referrers;
+ Paths pathsSorted;
if (isValidPath(path)) {
@@ -516,7 +517,8 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path)
}
/* The paths are garbage, so delete them. */
- foreach (PathSet::iterator, i, paths) {
+ pathsSorted = topoSortPaths(*this, paths);
+ foreach (Paths::iterator, i, pathsSorted) {
if (shouldDelete(state.options.action)) {
/* If it's a valid path that's not a regular file or