about summary refs log tree commit diff
path: root/src/nix-store/main.cc
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-store/main.cc
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-store/main.cc')
-rw-r--r--src/nix-store/main.cc44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index 1a9cbddbd80a..5a67a6af647d 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -18,21 +18,18 @@ void printHelp()
 }
 
 
-/* Realise paths from the given store expressions. */
-static void opRealise(Strings opFlags, Strings opArgs)
+/* Build the given derivations. */
+static void opBuild(Strings opFlags, Strings opArgs)
 {
     if (!opFlags.empty()) throw UsageError("unknown flag");
 
     for (Strings::iterator i = opArgs.begin();
          i != opArgs.end(); i++)
-    {
-        Path nfPath = realiseStoreExpr(*i);
-        cout << format("%1%\n") % (string) nfPath;
-    }
+        buildDerivation(*i);
 }
 
 
-/* Add paths to the Nix values directory and print the hashes of those
+/* Add files to the Nix values directory and print the resulting
    paths. */
 static void opAdd(Strings opFlags, Strings opArgs)
 {
@@ -43,6 +40,7 @@ static void opAdd(Strings opFlags, Strings opArgs)
 }
 
 
+#if 0
 Path maybeNormalise(const Path & ne, bool normalise, bool realise)
 {
     if (realise) {
@@ -131,24 +129,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
             abort();
     }
 }
-
-
-static void opSuccessor(Strings opFlags, Strings opArgs)
-{
-    if (!opFlags.empty()) throw UsageError("unknown flag");
-    if (opArgs.size() % 2) throw UsageError("expecting even number of arguments");
-
-    Transaction txn;
-    createStoreTransaction(txn);
-    for (Strings::iterator i = opArgs.begin();
-         i != opArgs.end(); )
-    {
-        Path path1 = *i++;
-        Path path2 = *i++;
-        registerSuccessor(txn, path1, path2);
-    }
-    txn.commit();
-}
+#endif
 
 
 static void opSubstitute(Strings opFlags, Strings opArgs)
@@ -195,7 +176,6 @@ static void opClearSubstitutes(Strings opFlags, Strings opArgs)
 }
 
 
-
 static void opValidPath(Strings opFlags, Strings opArgs)
 {
     if (!opFlags.empty()) throw UsageError("unknown flag");
@@ -222,6 +202,7 @@ static void opIsValid(Strings opFlags, Strings opArgs)
 
 static void opGC(Strings opFlags, Strings opArgs)
 {
+#if 0
     /* Do what? */
     enum { soPrintLive, soPrintDead, soDelete } subOp;
     time_t minAge = 0;
@@ -275,6 +256,7 @@ static void opGC(Strings opFlags, Strings opArgs)
             deleteFromStore(*i);
         }
     }
+#endif
 }
 
 
@@ -354,14 +336,12 @@ void run(Strings args)
 
         Operation oldOp = op;
 
-        if (arg == "--realise" || arg == "-r")
-            op = opRealise;
+        if (arg == "--build" || arg == "-b")
+            op = opBuild;
         else if (arg == "--add" || arg == "-A")
             op = opAdd;
-        else if (arg == "--query" || arg == "-q")
-            op = opQuery;
-        else if (arg == "--successor")
-            op = opSuccessor;
+        //        else if (arg == "--query" || arg == "-q")
+        //            op = opQuery;
         else if (arg == "--substitute")
             op = opSubstitute;
         else if (arg == "--clear-substitutes")