* "Nix expression" -> "store expression".

* More refactoring.
This commit is contained in:
Eelco Dolstra 2003-11-18 11:22:29 +00:00
parent 9f0f020929
commit ce92d1bf14
20 changed files with 121 additions and 119 deletions

View file

@ -52,7 +52,7 @@ string pathLabel(const Path & nePath, const string & elemPath)
}
void printClosure(const Path & nePath, const NixExpr & fs)
void printClosure(const Path & nePath, const StoreExpr & fs)
{
PathSet workList(fs.closure.roots);
PathSet doneSet;
@ -100,11 +100,11 @@ void printDotGraph(const PathSet & roots)
if (doneSet.find(nePath) == doneSet.end()) {
doneSet.insert(nePath);
NixExpr ne = exprFromPath(nePath);
StoreExpr ne = storeExprFromPath(nePath);
string label, colour;
if (ne.type == NixExpr::neDerivation) {
if (ne.type == StoreExpr::neDerivation) {
for (PathSet::iterator i = ne.derivation.inputs.begin();
i != ne.derivation.inputs.end(); i++)
{
@ -119,7 +119,7 @@ void printDotGraph(const PathSet & roots)
if (i->first == "name") label = i->second;
}
else if (ne.type == NixExpr::neClosure) {
else if (ne.type == StoreExpr::neClosure) {
label = "<closure>";
colour = "#00ffff";
printClosure(nePath, ne);

View file

@ -1,7 +1,7 @@
#ifndef __DOTGRAPH_H
#define __DOTGRAPH_H
#include "expr.hh"
#include "storeexpr.hh"
void printDotGraph(const PathSet & roots);

View file

@ -2,7 +2,7 @@ nix [OPTIONS...] [ARGUMENTS...]
Operations:
--install / -i: realise a Nix expression
--realise / -r: realise a Nix expression
--delete / -d: delete paths from the Nix store
--add / -A: copy a path to the Nix store
--query / -q: query information
@ -22,7 +22,7 @@ Operations:
Query flags:
--list / -l: query the output paths (roots) of a Nix expression (default)
--requisites / -r: print all paths necessary to realise expression
--requisites / -R: print all paths necessary to realise expression
--predecessors: print predecessors of a Nix expression
--graph: print a dot graph rooted at given ids

View file

@ -27,15 +27,15 @@ static Path checkPath(const Path & arg)
}
/* Realise (or install) paths from the given Nix expressions. */
static void opInstall(Strings opFlags, Strings opArgs)
/* Realise paths from the given store expressions. */
static void opRealise(Strings opFlags, Strings opArgs)
{
if (!opFlags.empty()) throw UsageError("unknown flag");
for (Strings::iterator i = opArgs.begin();
i != opArgs.end(); i++)
{
Path nfPath = normaliseNixExpr(checkPath(*i));
Path nfPath = normaliseStoreExpr(checkPath(*i));
realiseClosure(nfPath);
cout << format("%1%\n") % (string) nfPath;
}
@ -66,7 +66,7 @@ static void opAdd(Strings opFlags, Strings opArgs)
Path maybeNormalise(const Path & ne, bool normalise)
{
return normalise ? normaliseNixExpr(ne) : ne;
return normalise ? normaliseStoreExpr(ne) : ne;
}
@ -82,7 +82,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
for (Strings::iterator i = opFlags.begin();
i != opFlags.end(); i++)
if (*i == "--list" || *i == "-l") query = qList;
else if (*i == "--requisites" || *i == "-r") query = qRequisites;
else if (*i == "--requisites" || *i == "-R") query = qRequisites;
else if (*i == "--predecessors") query = qPredecessors;
else if (*i == "--graph") query = qGraph;
else if (*i == "--normalise" || *i == "-n") normalise = true;
@ -96,7 +96,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
for (Strings::iterator i = opArgs.begin();
i != opArgs.end(); i++)
{
StringSet paths = nixExprRoots(
StringSet paths = storeExprRoots(
maybeNormalise(checkPath(*i), normalise));
for (StringSet::iterator j = paths.begin();
j != paths.end(); j++)
@ -110,7 +110,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
for (Strings::iterator i = opArgs.begin();
i != opArgs.end(); i++)
{
StringSet paths2 = nixExprRequisites(
StringSet paths2 = storeExprRequisites(
maybeNormalise(checkPath(*i), normalise),
includeExprs, includeSuccessors);
paths.insert(paths2.begin(), paths2.end());
@ -258,8 +258,8 @@ void run(Strings args)
Operation oldOp = op;
if (arg == "--install" || arg == "-i")
op = opInstall;
if (arg == "--realise" || arg == "-r")
op = opRealise;
else if (arg == "--delete" || arg == "-d")
op = opDelete;
else if (arg == "--add" || arg == "-A")