diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-14T14·16+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-14T14·16+0000 |
commit | a04a5de8f70e5c34be0f0f7ea3c6f2cd50d56982 (patch) | |
tree | aff538892411417d4eb91a4820d761522b945288 | |
parent | 6a8ef36fe62c1b53572b0cf64685ece6190b22e5 (diff) |
* Implement the `gc-keep-derivations' global configuretion flag.
-rw-r--r-- | src/libstore/gc.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 98b863314ac9..e0de6a968131 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -306,7 +306,10 @@ void collectGarbage(GCAction action, PathSet & result) { result.clear(); - bool gcKeepOutputs = queryBoolSetting("gc-keep-outputs", false); + bool gcKeepOutputs = + queryBoolSetting("gc-keep-outputs", false); + bool gcKeepDerivations = + queryBoolSetting("gc-keep-derivations", true); /* Acquire the global GC root. This prevents a) New roots from being added. @@ -330,6 +333,16 @@ void collectGarbage(GCAction action, PathSet & result) for (PathSet::const_iterator i = roots.begin(); i != roots.end(); ++i) computeFSClosure(canonPath(*i), livePaths); + if (gcKeepDerivations) { + for (PathSet::iterator i = livePaths.begin(); + i != livePaths.end(); ++i) + { + Path deriver = queryDeriver(noTxn, *i); + if (deriver != "") + computeFSClosure(deriver, livePaths); + } + } + if (gcKeepOutputs) { /* Hmz, identical to storePathRequisites in nix-store. */ for (PathSet::iterator i = livePaths.begin(); |