* Always print hook output on stderr, even if --no-build-output is
set. * In the build hook, print a trace message to allow Hydra to pick up the name of the remote machine used for the build.
This commit is contained in:
parent
e2e168f7c2
commit
bf0dde9597
|
@ -42,7 +42,7 @@ sub all { $_ || return 0 for @_; 1 }
|
||||||
# Initialisation.
|
# Initialisation.
|
||||||
my $loadIncreased = 0;
|
my $loadIncreased = 0;
|
||||||
|
|
||||||
my ($localSystem, $maxSilentTime) = @ARGV;
|
my ($localSystem, $maxSilentTime, $printBuildTrace) = @ARGV;
|
||||||
$maxSilentTime = 0 unless defined $maxSilentTime;
|
$maxSilentTime = 0 unless defined $maxSilentTime;
|
||||||
|
|
||||||
my $currentLoad = $ENV{"NIX_CURRENT_LOAD"};
|
my $currentLoad = $ENV{"NIX_CURRENT_LOAD"};
|
||||||
|
@ -197,12 +197,15 @@ REQ: while (1) {
|
||||||
|
|
||||||
|
|
||||||
# Tell Nix we've accepted the build.
|
# Tell Nix we've accepted the build.
|
||||||
print STDERR "building `$drvPath' on `$hostName'\n";
|
|
||||||
sendReply "accept";
|
sendReply "accept";
|
||||||
my @inputs = split /\s/, readline(STDIN);
|
my @inputs = split /\s/, readline(STDIN);
|
||||||
my @outputs = split /\s/, readline(STDIN);
|
my @outputs = split /\s/, readline(STDIN);
|
||||||
|
|
||||||
|
|
||||||
|
print STDERR "building `$drvPath' on `$hostName'\n";
|
||||||
|
print STDERR "@ build-remote $drvPath $hostName\n" if $printBuildTrace;
|
||||||
|
|
||||||
|
|
||||||
my $maybeSign = "";
|
my $maybeSign = "";
|
||||||
$maybeSign = "--sign" if -e "/nix/etc/nix/signing-key.sec";
|
$maybeSign = "--sign" if -e "/nix/etc/nix/signing-key.sec";
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,9 @@ HookInstance::HookInstance()
|
||||||
throw SysError("dupping builder's stdout/stderr");
|
throw SysError("dupping builder's stdout/stderr");
|
||||||
|
|
||||||
execl(buildHook.c_str(), buildHook.c_str(), thisSystem.c_str(),
|
execl(buildHook.c_str(), buildHook.c_str(), thisSystem.c_str(),
|
||||||
(format("%1%") % maxSilentTime).str().c_str(), NULL);
|
(format("%1%") % maxSilentTime).str().c_str(),
|
||||||
|
(format("%1%") % printBuildTrace).str().c_str(),
|
||||||
|
NULL);
|
||||||
|
|
||||||
throw SysError(format("executing `%1%'") % buildHook);
|
throw SysError(format("executing `%1%'") % buildHook);
|
||||||
|
|
||||||
|
@ -1362,7 +1364,8 @@ HookReply DerivationGoal::tryBuildHook()
|
||||||
reply = string(s, 2);
|
reply = string(s, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
handleChildOutput(worker.hook->fromHook.readSide, s + "\n");
|
s += "\n";
|
||||||
|
writeToStderr((unsigned char *) s.c_str(), s.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(format("hook reply is `%1%'") % reply);
|
debug(format("hook reply is `%1%'") % reply);
|
||||||
|
@ -2023,11 +2026,16 @@ void DerivationGoal::deleteTmpDir(bool force)
|
||||||
|
|
||||||
void DerivationGoal::handleChildOutput(int fd, const string & data)
|
void DerivationGoal::handleChildOutput(int fd, const string & data)
|
||||||
{
|
{
|
||||||
if (verbosity >= buildVerbosity)
|
|
||||||
writeToStderr((unsigned char *) data.c_str(), data.size());
|
|
||||||
if ((hook && fd == hook->builderOut.readSide) ||
|
if ((hook && fd == hook->builderOut.readSide) ||
|
||||||
(!hook && fd == builderOut.readSide))
|
(!hook && fd == builderOut.readSide))
|
||||||
|
{
|
||||||
|
if (verbosity >= buildVerbosity)
|
||||||
|
writeToStderr((unsigned char *) data.c_str(), data.size());
|
||||||
writeFull(fdLogFile, (unsigned char *) data.c_str(), data.size());
|
writeFull(fdLogFile, (unsigned char *) data.c_str(), data.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hook && fd == hook->fromHook.readSide)
|
||||||
|
writeToStderr((unsigned char *) data.c_str(), data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue