about summary refs log tree commit diff
path: root/src/nix-store
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-12-20T13·43+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-12-20T13·43+0000
commitfa9259f5f519386b4f32ac9490bc73459773e589 (patch)
treec99bc5b3e04334020b8886081c6201246fab41ce /src/nix-store
parent015beb7cd04ee75d58bf09ef89816f9301cda646 (diff)
* Simplify the substitute mechanism:
  - Drop the store expression.  So now a substitute is just a
    command-line invocation (a program name + arguments).  If you
    register a substitute you are responsible for registering the
    expression that built it (if any) as a root of the garbage
    collector.
  - Drop the substitutes-rev DB table.

Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/help.txt1
-rw-r--r--src/nix-store/main.cc14
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nix-store/help.txt b/src/nix-store/help.txt
index a3dcdebb6faa..cbded730e866 100644
--- a/src/nix-store/help.txt
+++ b/src/nix-store/help.txt
@@ -11,6 +11,7 @@ Operations:
 
   --successor: register a successor expression (dangerous!)
   --substitute: register a substitute expression (dangerous!)
+  --clear-substitute: clear all substitutes
   --validpath: register path validity (dangerous!)
   --isvalid: check path validity
 
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index febe65e5c45e..1a9cbddbd80a 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -166,7 +166,6 @@ static void opSubstitute(Strings opFlags, Strings opArgs)
         Substitute sub;
         getline(cin, srcPath);
         if (cin.eof()) break;
-        getline(cin, sub.storeExpr);
         getline(cin, sub.program);
         string s;
         getline(cin, s);
@@ -186,6 +185,17 @@ static void opSubstitute(Strings opFlags, Strings opArgs)
 }
 
 
+static void opClearSubstitutes(Strings opFlags, Strings opArgs)
+{
+    if (!opFlags.empty()) throw UsageError("unknown flag");
+    if (!opArgs.empty())
+        throw UsageError("no arguments expected");
+
+    clearSubstitutes();
+}
+
+
+
 static void opValidPath(Strings opFlags, Strings opArgs)
 {
     if (!opFlags.empty()) throw UsageError("unknown flag");
@@ -354,6 +364,8 @@ void run(Strings args)
             op = opSuccessor;
         else if (arg == "--substitute")
             op = opSubstitute;
+        else if (arg == "--clear-substitutes")
+            op = opClearSubstitutes;
         else if (arg == "--validpath")
             op = opValidPath;
         else if (arg == "--isvalid")