about summary refs log tree commit diff
path: root/src/nix-env/profiles.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-02-11T10·25+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-02-11T10·25+0000
commit00fe1a506f045e612b0564ab0b5aff3917e26bd3 (patch)
tree25c2b9fdf93bf9ab9e67e86ff040a2feede23b41 /src/nix-env/profiles.cc
parent92e832348db13637875c4f529ed0aa83d3d34493 (diff)
* When creating a new generation, also make the normal form of the
  derivation (i.e., the closure store expression) a root of the
  garbage collector.  This ensures that running `nix-collect-garbage
  --no-successors' is safe.

Diffstat (limited to 'src/nix-env/profiles.cc')
-rw-r--r--src/nix-env/profiles.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nix-env/profiles.cc b/src/nix-env/profiles.cc
index a1e0c94a9198..d47c528b2d2c 100644
--- a/src/nix-env/profiles.cc
+++ b/src/nix-env/profiles.cc
@@ -58,7 +58,8 @@ Generations findGenerations(Path profile, int & curGen)
 }
 
 
-Path createGeneration(Path profile, Path outPath, Path drvPath)
+Path createGeneration(Path profile, Path outPath,
+    Path drvPath, Path clrPath)
 {
     /* The new generation number should be higher than old the
        previous ones. */
@@ -67,12 +68,13 @@ Path createGeneration(Path profile, Path outPath, Path drvPath)
     unsigned int num = gens.size() > 0 ? gens.front().number : 0;
         
     /* Create the new generation. */
-    Path generation, gcrootSrc;
+    Path generation, gcrootDrv, gcrootClr;
 
     while (1) {
         Path prefix = (format("%1%-%2%") % profile % num).str();
         generation = prefix + "-link";
-        gcrootSrc = prefix + "-src.gcroot";
+        gcrootDrv = prefix + "-drv.gcroot";
+        gcrootClr = prefix + "-clr.gcroot";
         if (symlink(outPath.c_str(), generation.c_str()) == 0) break;
         if (errno != EEXIST)
             throw SysError(format("creating symlink `%1%'") % generation);
@@ -80,7 +82,8 @@ Path createGeneration(Path profile, Path outPath, Path drvPath)
         num++;
     }
 
-    writeStringToFile(gcrootSrc, drvPath);
+    writeStringToFile(gcrootDrv, drvPath);
+    writeStringToFile(gcrootClr, clrPath);
 
     return generation;
 }