* The `-v' flag no longer takes an argument; it should be repeated
instead (e.g., `-vvvv' for lots of output). Default is to only print error messages.
This commit is contained in:
parent
3b521bb1bd
commit
0a0c1fcb4d
6 changed files with 29 additions and 38 deletions
23
src/fix.cc
23
src/fix.cc
|
@ -118,7 +118,6 @@ Hash hashPackage(EvalState & state, FState fs)
|
||||||
*i = j->second;
|
*i = j->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug(printTerm(unparseFState(fs)));
|
|
||||||
return hashTerm(unparseFState(fs));
|
return hashTerm(unparseFState(fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +175,10 @@ static Expr evalExpr2(EvalState & state, Expr e)
|
||||||
Hash pkgHash = hashPackage(state, fs);
|
Hash pkgHash = hashPackage(state, fs);
|
||||||
FSId pkgId = writeTerm(unparseFState(fs), "");
|
FSId pkgId = writeTerm(unparseFState(fs), "");
|
||||||
state.pkgHashes[pkgId] = pkgHash;
|
state.pkgHashes[pkgId] = pkgHash;
|
||||||
|
|
||||||
|
msg(lvlChatty, format("copied `%1%' -> %2%")
|
||||||
|
% srcPath % (string) pkgId);
|
||||||
|
|
||||||
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +247,6 @@ static Expr evalExpr2(EvalState & state, Expr e)
|
||||||
canonPath(nixStore + "/" + ((string) outId).c_str() + "-" + name);
|
canonPath(nixStore + "/" + ((string) outId).c_str() + "-" + name);
|
||||||
fs.derive.env.push_back(StringPair("out", outPath));
|
fs.derive.env.push_back(StringPair("out", outPath));
|
||||||
fs.derive.outputs.push_back(DeriveOutput(outPath, outId));
|
fs.derive.outputs.push_back(DeriveOutput(outPath, outId));
|
||||||
debug(format("%1%: %2%") % (string) outId % name);
|
|
||||||
|
|
||||||
/* Write the resulting term into the Nix store directory. */
|
/* Write the resulting term into the Nix store directory. */
|
||||||
Hash pkgHash = outIdGiven
|
Hash pkgHash = outIdGiven
|
||||||
|
@ -252,6 +254,10 @@ static Expr evalExpr2(EvalState & state, Expr e)
|
||||||
: hashPackage(state, fs);
|
: hashPackage(state, fs);
|
||||||
FSId pkgId = writeTerm(unparseFState(fs), "-d-" + name);
|
FSId pkgId = writeTerm(unparseFState(fs), "-d-" + name);
|
||||||
state.pkgHashes[pkgId] = pkgHash;
|
state.pkgHashes[pkgId] = pkgHash;
|
||||||
|
|
||||||
|
msg(lvlChatty, format("instantiated `%1%' -> %2%")
|
||||||
|
% name % (string) pkgId);
|
||||||
|
|
||||||
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
return ATmake("FSId(<str>)", ((string) pkgId).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +291,7 @@ static Expr evalExpr(EvalState & state, Expr e)
|
||||||
static Expr evalFile(EvalState & state, string relPath)
|
static Expr evalFile(EvalState & state, string relPath)
|
||||||
{
|
{
|
||||||
string path = searchPath(state.searchDirs, relPath);
|
string path = searchPath(state.searchDirs, relPath);
|
||||||
|
Nest nest(lvlTalkative, format("evaluating file `%1%'") % path);
|
||||||
Expr e = ATreadFromNamedFile(path.c_str());
|
Expr e = ATreadFromNamedFile(path.c_str());
|
||||||
if (!e)
|
if (!e)
|
||||||
throw Error(format("unable to read a term from `%1%'") % path);
|
throw Error(format("unable to read a term from `%1%'") % path);
|
||||||
|
@ -310,16 +317,8 @@ void run(Strings args)
|
||||||
throw UsageError(format("argument required in `%1%'") % arg);
|
throw UsageError(format("argument required in `%1%'") % arg);
|
||||||
state.searchDirs.push_back(*it++);
|
state.searchDirs.push_back(*it++);
|
||||||
}
|
}
|
||||||
else if (arg == "--verbose" || arg == "-v") {
|
else if (arg == "--verbose" || arg == "-v")
|
||||||
if (it == args.end()) throw UsageError(
|
verbosity = (Verbosity) ((int) verbosity + 1);
|
||||||
format("`%1%' requires an argument") % arg);
|
|
||||||
istringstream str(*it++);
|
|
||||||
int lvl;
|
|
||||||
str >> lvl;
|
|
||||||
if (str.fail()) throw UsageError(
|
|
||||||
format("`%1%' requires an integer argument") % arg);
|
|
||||||
verbosity = (Verbosity) lvl;
|
|
||||||
}
|
|
||||||
else if (arg[0] == '-')
|
else if (arg[0] == '-')
|
||||||
throw UsageError(format("unknown flag `%1%`") % arg);
|
throw UsageError(format("unknown flag `%1%`") % arg);
|
||||||
else
|
else
|
||||||
|
|
12
src/nix.cc
12
src/nix.cc
|
@ -307,16 +307,8 @@ void run(Strings args)
|
||||||
op = opVerify;
|
op = opVerify;
|
||||||
else if (arg == "--path" || arg == "-p")
|
else if (arg == "--path" || arg == "-p")
|
||||||
pathArgs = true;
|
pathArgs = true;
|
||||||
else if (arg == "--verbose" || arg == "-v") {
|
else if (arg == "--verbose" || arg == "-v")
|
||||||
if (it == args.end()) throw UsageError(
|
verbosity = (Verbosity) ((int) verbosity + 1);
|
||||||
format("`%1%' requires an argument") % arg);
|
|
||||||
istringstream str(*it++);
|
|
||||||
int lvl;
|
|
||||||
str >> lvl;
|
|
||||||
if (str.fail()) throw UsageError(
|
|
||||||
format("`%1%' requires an integer argument") % arg);
|
|
||||||
verbosity = (Verbosity) lvl;
|
|
||||||
}
|
|
||||||
else if (arg[0] == '-')
|
else if (arg[0] == '-')
|
||||||
opFlags.push_back(arg);
|
opFlags.push_back(arg);
|
||||||
else
|
else
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef set<FSId> FSIdSet;
|
||||||
|
|
||||||
Slice normaliseFState(FSId id, FSIdSet pending)
|
Slice normaliseFState(FSId id, FSIdSet pending)
|
||||||
{
|
{
|
||||||
Nest nest(lvlDebug, format("normalising fstate %1%") % (string) id);
|
Nest nest(lvlTalkative, format("normalising fstate %1%") % (string) id);
|
||||||
|
|
||||||
/* Try to substitute $id$ by any known successors in order to
|
/* Try to substitute $id$ by any known successors in order to
|
||||||
speed up the rewrite process. */
|
speed up the rewrite process. */
|
||||||
|
@ -80,7 +80,7 @@ Slice normaliseFState(FSId id, FSIdSet pending)
|
||||||
for (DeriveOutputs::iterator i = fs.derive.outputs.begin();
|
for (DeriveOutputs::iterator i = fs.derive.outputs.begin();
|
||||||
i != fs.derive.outputs.end(); i++)
|
i != fs.derive.outputs.end(); i++)
|
||||||
{
|
{
|
||||||
debug(format("building %1% in %2%") % (string) i->second % i->first);
|
debug(format("building %1% in `%2%'") % (string) i->second % i->first);
|
||||||
outPaths[i->first] = i->second;
|
outPaths[i->first] = i->second;
|
||||||
inPaths.push_back(i->first);
|
inPaths.push_back(i->first);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ Slice normaliseFState(FSId id, FSIdSet pending)
|
||||||
try {
|
try {
|
||||||
expandId(i->second, i->first, "/", pending);
|
expandId(i->second, i->first, "/", pending);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
debug(format("fast build failed: %1%") % e.what());
|
debug(format("fast build failed for %1%") % e.what());
|
||||||
fastBuild = false;
|
fastBuild = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -109,12 +109,12 @@ Slice normaliseFState(FSId id, FSIdSet pending)
|
||||||
throw Error(format("path `%1%' exists") % i->first);
|
throw Error(format("path `%1%' exists") % i->first);
|
||||||
|
|
||||||
/* Run the builder. */
|
/* Run the builder. */
|
||||||
debug(format("building..."));
|
msg(lvlChatty, format("building..."));
|
||||||
runProgram(fs.derive.builder, env);
|
runProgram(fs.derive.builder, env);
|
||||||
debug(format("build completed"));
|
msg(lvlChatty, format("build completed"));
|
||||||
|
|
||||||
} else
|
} else
|
||||||
debug(format("skipping build"));
|
msg(lvlChatty, format("fast build succesful"));
|
||||||
|
|
||||||
/* Check whether the output paths were created, and register each
|
/* Check whether the output paths were created, and register each
|
||||||
one. */
|
one. */
|
||||||
|
@ -167,7 +167,7 @@ Slice normaliseFState(FSId id, FSIdSet pending)
|
||||||
|
|
||||||
fs.type = FState::fsSlice;
|
fs.type = FState::fsSlice;
|
||||||
ATerm nf = unparseFState(fs);
|
ATerm nf = unparseFState(fs);
|
||||||
debug(format("normal form: %1%") % printTerm(nf));
|
msg(lvlVomit, format("normal form: %1%") % printTerm(nf));
|
||||||
storeSuccessor(id, nf);
|
storeSuccessor(id, nf);
|
||||||
|
|
||||||
return fs.slice;
|
return fs.slice;
|
||||||
|
@ -206,7 +206,7 @@ void realiseSlice(const Slice & slice, FSIdSet pending)
|
||||||
i != slice.elems.end(); i++)
|
i != slice.elems.end(); i++)
|
||||||
{
|
{
|
||||||
SliceElem elem = *i;
|
SliceElem elem = *i;
|
||||||
debug(format("expanding %1% in %2%") % (string) elem.id % elem.path);
|
debug(format("expanding %1% in `%2%'") % (string) elem.id % elem.path);
|
||||||
expandId(elem.id, elem.path, "/", pending);
|
expandId(elem.id, elem.path, "/", pending);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,6 @@ bool isInPrefix(const string & path, const string & _prefix)
|
||||||
string expandId(const FSId & id, const string & target,
|
string expandId(const FSId & id, const string & target,
|
||||||
const string & prefix, FSIdSet pending)
|
const string & prefix, FSIdSet pending)
|
||||||
{
|
{
|
||||||
debug(format("expanding %1%") % (string) id);
|
|
||||||
Nest nest(lvlDebug, format("expanding %1%") % (string) id);
|
Nest nest(lvlDebug, format("expanding %1%") % (string) id);
|
||||||
|
|
||||||
Strings paths;
|
Strings paths;
|
||||||
|
|
|
@ -130,7 +130,7 @@ void deletePath(string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Verbosity verbosity = lvlNormal;
|
Verbosity verbosity = lvlError;
|
||||||
|
|
||||||
static int nestingLevel = 0;
|
static int nestingLevel = 0;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ void msg(Verbosity level, const format & f)
|
||||||
|
|
||||||
void debug(const format & f)
|
void debug(const format & f)
|
||||||
{
|
{
|
||||||
msg(lvlDebug, format("debug: %1%") % f.str());
|
msg(lvlDebug, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
11
src/util.hh
11
src/util.hh
|
@ -73,10 +73,11 @@ void deletePath(string path);
|
||||||
/* Messages. */
|
/* Messages. */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
lvlError = 0,
|
lvlError,
|
||||||
lvlNormal = 5,
|
lvlTalkative,
|
||||||
lvlDebug = 10,
|
lvlChatty,
|
||||||
lvlDebugMore = 15
|
lvlDebug,
|
||||||
|
lvlVomit
|
||||||
} Verbosity;
|
} Verbosity;
|
||||||
|
|
||||||
extern Verbosity verbosity; /* supress msgs > this */
|
extern Verbosity verbosity; /* supress msgs > this */
|
||||||
|
@ -91,7 +92,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void msg(Verbosity level, const format & f);
|
void msg(Verbosity level, const format & f);
|
||||||
void debug(const format & f); /* shorthand */
|
void debug(const format & f); /* short-hand for msg(lvlDebug, ...) */
|
||||||
|
|
||||||
|
|
||||||
/* Wrappers arount read()/write() that read/write exactly the
|
/* Wrappers arount read()/write() that read/write exactly the
|
||||||
|
|
Loading…
Reference in a new issue