forked from lix-project/lix
* Some somewhat ad hoc mechanism to allow the build farm to monitor
build progress.
This commit is contained in:
parent
96598e7b06
commit
a519bb0635
|
@ -220,6 +220,8 @@ static void initAndRun(int argc, char * * argv)
|
||||||
; /* !!! obsolete - remove eventually */
|
; /* !!! obsolete - remove eventually */
|
||||||
else if (arg == "--no-build-output" || arg == "-Q")
|
else if (arg == "--no-build-output" || arg == "-Q")
|
||||||
buildVerbosity = lvlVomit;
|
buildVerbosity = lvlVomit;
|
||||||
|
else if (arg == "--print-build-trace")
|
||||||
|
printBuildTrace = true;
|
||||||
else if (arg == "--help") {
|
else if (arg == "--help") {
|
||||||
printHelp();
|
printHelp();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -778,7 +778,7 @@ private:
|
||||||
void computeClosure();
|
void computeClosure();
|
||||||
|
|
||||||
/* Open a log file and a pipe to it. */
|
/* Open a log file and a pipe to it. */
|
||||||
void openLogFile();
|
Path openLogFile();
|
||||||
|
|
||||||
/* Common initialisation to be performed in child processes (i.e.,
|
/* Common initialisation to be performed in child processes (i.e.,
|
||||||
both in builders and in build hooks). */
|
both in builders and in build hooks). */
|
||||||
|
@ -1081,6 +1081,10 @@ void DerivationGoal::tryToBuild()
|
||||||
|
|
||||||
} catch (BuildError & e) {
|
} catch (BuildError & e) {
|
||||||
printMsg(lvlError, e.msg());
|
printMsg(lvlError, e.msg());
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ build-failed %1% %2% %3% %4%")
|
||||||
|
% drvPath % drv.outputs["out"].path % 0 % e.msg());
|
||||||
|
}
|
||||||
amDone(ecFailed);
|
amDone(ecFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1171,9 +1175,13 @@ void DerivationGoal::buildDone()
|
||||||
/* Compute the FS closure of the outputs and register them as
|
/* Compute the FS closure of the outputs and register them as
|
||||||
being valid. */
|
being valid. */
|
||||||
computeClosure();
|
computeClosure();
|
||||||
|
|
||||||
} catch (BuildError & e) {
|
} catch (BuildError & e) {
|
||||||
printMsg(lvlError, e.msg());
|
printMsg(lvlError, e.msg());
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ build-failed %1% %2% %3% %4%")
|
||||||
|
% drvPath % drv.outputs["out"].path % status % e.msg());
|
||||||
|
}
|
||||||
amDone(ecFailed);
|
amDone(ecFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1181,6 +1189,11 @@ void DerivationGoal::buildDone()
|
||||||
/* Release the build user, if applicable. */
|
/* Release the build user, if applicable. */
|
||||||
buildUser.release();
|
buildUser.release();
|
||||||
|
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ build-succeeded %1% %2%")
|
||||||
|
% drvPath % drv.outputs["out"].path);
|
||||||
|
}
|
||||||
|
|
||||||
amDone(ecSuccess);
|
amDone(ecSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,7 +1263,7 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
|
||||||
tmpDir = createTempDir();
|
tmpDir = createTempDir();
|
||||||
|
|
||||||
/* Create the log file and pipe. */
|
/* Create the log file and pipe. */
|
||||||
openLogFile();
|
Path logFile = openLogFile();
|
||||||
|
|
||||||
/* Create the communication pipes. */
|
/* Create the communication pipes. */
|
||||||
toHook.create();
|
toHook.create();
|
||||||
|
@ -1369,6 +1382,11 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
|
||||||
/* Tell the hook to proceed. */
|
/* Tell the hook to proceed. */
|
||||||
writeLine(toHook.writeSide, "okay");
|
writeLine(toHook.writeSide, "okay");
|
||||||
|
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ build-started %1% %2% %3% %4%")
|
||||||
|
% drvPath % drv.outputs["out"].path % drv.platform % logFile);
|
||||||
|
}
|
||||||
|
|
||||||
return rpAccept;
|
return rpAccept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1774,7 +1792,7 @@ void DerivationGoal::startBuilder()
|
||||||
drv.builder);
|
drv.builder);
|
||||||
|
|
||||||
/* Create the log file and pipe. */
|
/* Create the log file and pipe. */
|
||||||
openLogFile();
|
Path logFile = openLogFile();
|
||||||
|
|
||||||
/* Fork a child to build the package. Note that while we
|
/* Fork a child to build the package. Note that while we
|
||||||
currently use forks to run and wait for the children, it
|
currently use forks to run and wait for the children, it
|
||||||
|
@ -1878,6 +1896,11 @@ void DerivationGoal::startBuilder()
|
||||||
logPipe.writeSide.close();
|
logPipe.writeSide.close();
|
||||||
worker.childStarted(shared_from_this(), pid,
|
worker.childStarted(shared_from_this(), pid,
|
||||||
singleton<set<int> >(logPipe.readSide), true);
|
singleton<set<int> >(logPipe.readSide), true);
|
||||||
|
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ build-started %1% %2% %3% %4%")
|
||||||
|
% drvPath % drv.outputs["out"].path % drv.platform % logFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2023,7 +2046,7 @@ void DerivationGoal::computeClosure()
|
||||||
string drvsLogDir = "drvs";
|
string drvsLogDir = "drvs";
|
||||||
|
|
||||||
|
|
||||||
void DerivationGoal::openLogFile()
|
Path DerivationGoal::openLogFile()
|
||||||
{
|
{
|
||||||
/* Create a log file. */
|
/* Create a log file. */
|
||||||
Path dir = (format("%1%/%2%") % nixLogDir % drvsLogDir).str();
|
Path dir = (format("%1%/%2%") % nixLogDir % drvsLogDir).str();
|
||||||
|
@ -2037,6 +2060,8 @@ void DerivationGoal::openLogFile()
|
||||||
|
|
||||||
/* Create a pipe to get the output of the child. */
|
/* Create a pipe to get the output of the child. */
|
||||||
logPipe.create();
|
logPipe.create();
|
||||||
|
|
||||||
|
return logFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2367,6 +2392,11 @@ void SubstitutionGoal::tryToRun()
|
||||||
pid, singleton<set<int> >(logPipe.readSide), true);
|
pid, singleton<set<int> >(logPipe.readSide), true);
|
||||||
|
|
||||||
state = &SubstitutionGoal::finished;
|
state = &SubstitutionGoal::finished;
|
||||||
|
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ substituter-started %1% %2%")
|
||||||
|
% storePath % sub);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2406,6 +2436,11 @@ void SubstitutionGoal::finished()
|
||||||
format("substitution of path `%1%' using substituter `%2%' failed: %3%")
|
format("substitution of path `%1%' using substituter `%2%' failed: %3%")
|
||||||
% storePath % sub % e.msg());
|
% storePath % sub % e.msg());
|
||||||
|
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ substituter-failed %1% %2% %3%")
|
||||||
|
% storePath % status % e.msg());
|
||||||
|
}
|
||||||
|
|
||||||
/* Try the next substitute. */
|
/* Try the next substitute. */
|
||||||
state = &SubstitutionGoal::tryNext;
|
state = &SubstitutionGoal::tryNext;
|
||||||
worker.wakeUp(shared_from_this());
|
worker.wakeUp(shared_from_this());
|
||||||
|
@ -2424,6 +2459,10 @@ void SubstitutionGoal::finished()
|
||||||
printMsg(lvlChatty,
|
printMsg(lvlChatty,
|
||||||
format("substitution of path `%1%' succeeded") % storePath);
|
format("substitution of path `%1%' succeeded") % storePath);
|
||||||
|
|
||||||
|
if (printBuildTrace) {
|
||||||
|
printMsg(lvlError, format("@ substituter-succeeded %1%") % storePath);
|
||||||
|
}
|
||||||
|
|
||||||
amDone(ecSuccess);
|
amDone(ecSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ string thisSystem = "unset";
|
||||||
unsigned int maxSilentTime = 0;
|
unsigned int maxSilentTime = 0;
|
||||||
Paths substituters;
|
Paths substituters;
|
||||||
bool useBuildHook = true;
|
bool useBuildHook = true;
|
||||||
|
bool printBuildTrace = false;
|
||||||
|
|
||||||
|
|
||||||
static bool settingsRead = false;
|
static bool settingsRead = false;
|
||||||
|
|
|
@ -82,6 +82,22 @@ extern Paths substituters;
|
||||||
users want to disable this from the command-line. */
|
users want to disable this from the command-line. */
|
||||||
extern bool useBuildHook;
|
extern bool useBuildHook;
|
||||||
|
|
||||||
|
/* Whether buildDerivations() should print out lines on stderr in a
|
||||||
|
fixed format to allow its progress to be monitored. Each line
|
||||||
|
starts with a "@". The following are defined:
|
||||||
|
|
||||||
|
@ build-started <drvpath> <outpath> <system> <logfile>
|
||||||
|
@ build-failed <drvpath> <outpath> <exitcode> <error text>
|
||||||
|
@ build-succeeded <drvpath> <outpath>
|
||||||
|
@ substituter-started <outpath> <substituter>
|
||||||
|
@ substituter-failed <outpath> <exitcode> <error text>
|
||||||
|
@ substituter-succeeded <outpath>
|
||||||
|
|
||||||
|
Best combined with --no-build-output, otherwise stderr might
|
||||||
|
conceivably contain lines in this format printed by the builders.
|
||||||
|
*/
|
||||||
|
extern bool printBuildTrace;
|
||||||
|
|
||||||
|
|
||||||
Strings querySetting(const string & name, const Strings & def);
|
Strings querySetting(const string & name, const Strings & def);
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,11 @@ void RemoteStore::setOptions()
|
||||||
writeInt(maxSilentTime, to);
|
writeInt(maxSilentTime, to);
|
||||||
if (GET_PROTOCOL_MINOR(daemonVersion) >= 2)
|
if (GET_PROTOCOL_MINOR(daemonVersion) >= 2)
|
||||||
writeInt(useBuildHook, to);
|
writeInt(useBuildHook, to);
|
||||||
if (GET_PROTOCOL_MINOR(daemonVersion) >= 4)
|
if (GET_PROTOCOL_MINOR(daemonVersion) >= 4) {
|
||||||
writeInt(buildVerbosity, to);
|
writeInt(buildVerbosity, to);
|
||||||
|
writeInt(logType, to);
|
||||||
|
writeInt(printBuildTrace, to);
|
||||||
|
}
|
||||||
processStderr();
|
processStderr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -426,8 +426,11 @@ static void performOp(unsigned int clientVersion,
|
||||||
maxSilentTime = readInt(from);
|
maxSilentTime = readInt(from);
|
||||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 2)
|
if (GET_PROTOCOL_MINOR(clientVersion) >= 2)
|
||||||
useBuildHook = readInt(from) != 0;
|
useBuildHook = readInt(from) != 0;
|
||||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 4)
|
if (GET_PROTOCOL_MINOR(clientVersion) >= 4) {
|
||||||
buildVerbosity = (Verbosity) readInt(from);
|
buildVerbosity = (Verbosity) readInt(from);
|
||||||
|
logType = (LogType) readInt(from);
|
||||||
|
printBuildTrace = readInt(from) != 0;
|
||||||
|
}
|
||||||
startWork();
|
startWork();
|
||||||
stopWork();
|
stopWork();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue