about summary refs log tree commit diff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-19T11·16+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-19T11·16+0000
commit863dcff6c5ffc163010ec1f9e6819bb9aaaadc29 (patch)
tree4747222c7f8c471e6cbfa07c49023853d2f6b957 /src/nix-env
parente9762e2d10c4a837e3d75d53e3a24452f07f47ec (diff)
* Started removing closure store expressions, i.e., the explicit
  representation of closures as ATerms in the Nix store.  Instead, the
  file system pointer graph is now stored in the Nix database.  This
  has many advantages:

  - It greatly simplifies the implementation (we can drop the notion
    of `successors', and so on).

  - It makes registering roots for the garbage collector much easier.
    Instead of specifying the closure expression as a root, you can
    simply specify the store path that must be retained as a root.
    This could not be done previously, since there was no way to find
    the closure store expression containing a given store path.
    
  - Better traceability: it is now possible to query what paths are
    referenced by a path, and what paths refer to a path.

Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/main.cc6
-rw-r--r--src/nix-env/profiles.cc18
-rw-r--r--src/nix-env/profiles.hh3
3 files changed, 11 insertions, 16 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index 0dd4efa30f31..c9498907d5c6 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -222,13 +222,13 @@ void createUserEnv(EvalState & state, const DrvInfos & drvs,
         abort();
     
     /* Realise the resulting store expression. */
-    debug(format("realising user environment"));
-    Path nfPath = realiseStoreExpr(topLevelDrv.drvPath);
+    debug(format("building user environment"));
+    buildDerivation(topLevelDrv.drvPath);
 
     /* Switch the current user environment to the output path. */
     debug(format("switching to new user environment"));
     Path generation = createGeneration(profile,
-        topLevelDrv.outPath, topLevelDrv.drvPath, nfPath);
+        topLevelDrv.outPath, topLevelDrv.drvPath);
     switchLink(profile, generation);
 }
 
diff --git a/src/nix-env/profiles.cc b/src/nix-env/profiles.cc
index c52ddc0b6988..96467831f128 100644
--- a/src/nix-env/profiles.cc
+++ b/src/nix-env/profiles.cc
@@ -18,7 +18,7 @@ static int parseName(const string & profileName, const string & name)
 {
     if (string(name, 0, profileName.size() + 1) != profileName + "-") return -1;
     string s = string(name, profileName.size() + 1);
-    int p = s.find("-link");
+    unsigned int p = s.find("-link");
     if (p == string::npos) return -1;
     int n;
     if (string2Int(string(s, 0, p), n) && n >= 0)
@@ -62,17 +62,15 @@ Generations findGenerations(Path profile, int & curGen)
 
 
 static void makeNames(const Path & profile, unsigned int num,
-    Path & generation, Path & gcrootDrv, Path & gcrootClr)
+    Path & generation, Path & gcrootDrv)
 {
     Path prefix = (format("%1%-%2%") % profile % num).str();
     generation = prefix + "-link";
     gcrootDrv = prefix + "-drv.gcroot";
-    gcrootClr = prefix + "-clr.gcroot";
 }
 
 
-Path createGeneration(Path profile, Path outPath,
-    Path drvPath, Path clrPath)
+Path createGeneration(Path profile, Path outPath, Path drvPath)
 {
     /* The new generation number should be higher than old the
        previous ones. */
@@ -81,10 +79,10 @@ Path createGeneration(Path profile, Path outPath,
     unsigned int num = gens.size() > 0 ? gens.front().number : 0;
         
     /* Create the new generation. */
-    Path generation, gcrootDrv, gcrootClr;
+    Path generation, gcrootDrv;
 
     while (1) {
-        makeNames(profile, num, generation, gcrootDrv, gcrootClr);
+        makeNames(profile, num, generation, gcrootDrv);
         if (symlink(outPath.c_str(), generation.c_str()) == 0) break;
         if (errno != EEXIST)
             throw SysError(format("creating symlink `%1%'") % generation);
@@ -93,7 +91,6 @@ Path createGeneration(Path profile, Path outPath,
     }
 
     writeStringToFile(gcrootDrv, drvPath);
-    writeStringToFile(gcrootClr, clrPath);
 
     return generation;
 }
@@ -108,10 +105,9 @@ static void removeFile(const Path & path)
 
 void deleteGeneration(const Path & profile, unsigned int gen)
 {
-    Path generation, gcrootDrv, gcrootClr;
-    makeNames(profile, gen, generation, gcrootDrv, gcrootClr);
+    Path generation, gcrootDrv;
+    makeNames(profile, gen, generation, gcrootDrv);
     removeFile(generation);
-    if (pathExists(gcrootClr)) removeFile(gcrootClr);
     if (pathExists(gcrootDrv)) removeFile(gcrootDrv);
 }
 
diff --git a/src/nix-env/profiles.hh b/src/nix-env/profiles.hh
index bcd882c34c93..58e45835eab4 100644
--- a/src/nix-env/profiles.hh
+++ b/src/nix-env/profiles.hh
@@ -28,8 +28,7 @@ typedef list<Generation> Generations;
    profile, sorted by generation number. */
 Generations findGenerations(Path profile, int & curGen);
     
-Path createGeneration(Path profile, Path outPath,
-    Path drvPath, Path clrPath);
+Path createGeneration(Path profile, Path outPath, Path drvPath);
 
 void deleteGeneration(const Path & profile, unsigned int gen);