* Some more nesting.

This commit is contained in:
Eelco Dolstra 2004-03-22 21:42:28 +00:00
parent 777e13b94b
commit 7823db2137
3 changed files with 40 additions and 14 deletions

View file

@ -164,14 +164,18 @@ Path normaliseStoreExpr(const Path & _nePath, PathSet pending)
} }
/* Run the builder. */ /* Run the builder. */
printMsg(lvlChatty, format("building...")); startNest(nest2, lvlChatty,
format("executing builder `%1%'") % ne.derivation.builder);
runProgram(ne.derivation.builder, ne.derivation.args, env, runProgram(ne.derivation.builder, ne.derivation.args, env,
nixLogDir + "/" + baseNameOf(nePath)); nixLogDir + "/" + baseNameOf(nePath));
printMsg(lvlChatty, format("build completed")); printMsg(lvlChatty, format("builder completed"));
nest2.close();
} else } else
printMsg(lvlChatty, format("fast build succesful")); printMsg(lvlChatty, format("fast build succesful"));
startNest(nest3, lvlChatty, format("determining closure value"));
/* Check whether the output paths were created, and grep each /* Check whether the output paths were created, and grep each
output path to determine what other paths it references. Also make all output path to determine what other paths it references. Also make all
output paths read-only. */ output paths read-only. */
@ -188,8 +192,11 @@ Path normaliseStoreExpr(const Path & _nePath, PathSet pending)
/* For this output path, find the references to other paths contained /* For this output path, find the references to other paths contained
in it. */ in it. */
startNest(nest2, lvlChatty,
format("scanning for store references in `%1%'") % ne.derivation.builder);
Strings refPaths = filterReferences(path, Strings refPaths = filterReferences(path,
Strings(allPaths.begin(), allPaths.end())); Strings(allPaths.begin(), allPaths.end()));
nest2.close();
/* Construct a closure element for this output path. */ /* Construct a closure element for this output path. */
ClosureElem elem; ClosureElem elem;
@ -241,11 +248,13 @@ Path normaliseStoreExpr(const Path & _nePath, PathSet pending)
{ {
PathSet::iterator j = donePaths.find(i->first); PathSet::iterator j = donePaths.find(i->first);
if (j == donePaths.end()) if (j == donePaths.end())
debug(format("NOT referenced: `%1%'") % i->first); debug(format("unreferenced input: `%1%'") % i->first);
else else
debug(format("referenced: `%1%'") % i->first); debug(format("referenced input: `%1%'") % i->first);
} }
nest3.close();
/* Write the normal form. This does not have to occur in the /* Write the normal form. This does not have to occur in the
transaction below because writing terms is idem-potent. */ transaction below because writing terms is idem-potent. */
ATerm nfTerm = unparseStoreExpr(nf); ATerm nfTerm = unparseStoreExpr(nf);

View file

@ -144,11 +144,11 @@ Strings readDirectory(const Path & path)
} }
void deletePath(const Path & path) static void _deletePath(const Path & path)
{ {
checkInterrupt(); checkInterrupt();
printMsg(lvlVomit, format("deleting path `%1%'") % path); printMsg(lvlVomit, format("%1%") % path);
struct stat st; struct stat st;
if (lstat(path.c_str(), &st)) if (lstat(path.c_str(), &st))
@ -164,7 +164,7 @@ void deletePath(const Path & path)
} }
for (Strings::iterator i = names.begin(); i != names.end(); ++i) for (Strings::iterator i = names.begin(); i != names.end(); ++i)
deletePath(path + "/" + *i); _deletePath(path + "/" + *i);
} }
if (remove(path.c_str()) == -1) if (remove(path.c_str()) == -1)
@ -172,6 +172,14 @@ void deletePath(const Path & path)
} }
void deletePath(const Path & path)
{
startNest(nest, lvlDebug,
format("recursively deleting path `%1%'") % path);
_deletePath(path);
}
void makePathReadOnly(const Path & path) void makePathReadOnly(const Path & path)
{ {
checkInterrupt(); checkInterrupt();
@ -238,11 +246,7 @@ Nest::Nest()
Nest::~Nest() Nest::~Nest()
{ {
if (nest) { close();
nestingLevel--;
if (logType == ltEscapes)
cerr << "\033[q";
}
} }
@ -259,14 +263,26 @@ void Nest::open(Verbosity level, const format & f)
{ {
if (level <= verbosity) { if (level <= verbosity) {
if (logType == ltEscapes) if (logType == ltEscapes)
cerr << "\033[" << escVerbosity(level) << "p"; cerr << "\033[" << escVerbosity(level) << "p"
printMsg_(level, f); << f.str() << "\n";
else
printMsg_(level, f);
nest = true; nest = true;
nestingLevel++; nestingLevel++;
} }
} }
void Nest::close()
{
if (nest) {
nestingLevel--;
if (logType == ltEscapes)
cerr << "\033[q";
}
}
void printMsg_(Verbosity level, const format & f) void printMsg_(Verbosity level, const format & f)
{ {
checkInterrupt(); checkInterrupt();

View file

@ -127,6 +127,7 @@ public:
Nest(); Nest();
~Nest(); ~Nest();
void open(Verbosity level, const format & f); void open(Verbosity level, const format & f);
void close();
}; };
void printMsg_(Verbosity level, const format & f); void printMsg_(Verbosity level, const format & f);