From 863dcff6c5ffc163010ec1f9e6819bb9aaaadc29 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Jan 2005 11:16:11 +0000 Subject: * 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. --- src/nix-store/dotgraph.cc | 2 ++ src/nix-store/main.cc | 44 ++++++++++++-------------------------------- 2 files changed, 14 insertions(+), 32 deletions(-) (limited to 'src/nix-store') diff --git a/src/nix-store/dotgraph.cc b/src/nix-store/dotgraph.cc index b13846c04..67473a81f 100644 --- a/src/nix-store/dotgraph.cc +++ b/src/nix-store/dotgraph.cc @@ -2,6 +2,7 @@ #include "normalise.hh" +#if 0 static string dotQuote(const string & s) { return "\"" + s + "\""; @@ -133,3 +134,4 @@ void printDotGraph(const PathSet & roots) cout << "}\n"; } +#endif diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc index 1a9cbddbd..5a67a6af6 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") -- cgit v1.2.3