This commit is contained in:
Eelco Dolstra 2008-11-12 13:00:56 +00:00
parent 80a2350a0a
commit 356b77bb95
3 changed files with 59 additions and 7 deletions

View file

@ -140,6 +140,8 @@ sub nixlog :Local {
my $step = $build->buildsteps->find({stepnr => $stepnr});
return error($c, "Build $id doesn't have a build step $stepnr.") if !defined $step;
return error($c, "Build step $stepnr of build $id does not have a log file.") if $step->logfile eq "";
$c->stash->{template} = 'log.tt';
$c->stash->{id} = $id;
$c->stash->{step} = $step;

View file

@ -147,7 +147,11 @@
<tr>
<td>[% step.stepnr %]</td>
<td>
Build of <tt>[% step.outpath %]</tt>
[% IF step.type == 0 %]
Build of <tt>[% step.outpath %]</tt>
[% ELSE %]
Substitution of <tt>[% step.outpath %]</tt>
[% END %]
</td>
<td>
[% IF step.busy == 0 %]
@ -164,7 +168,9 @@
[% ELSE %]
<strong class="error-msg">Failed: [% step.errormsg %]</strong>
[% END %]
(<a href="[% c.uri_for('/nixlog' build.id step.stepnr) %]">log</a>)
[% IF step.logfile %]
(<a href="[% c.uri_for('/nixlog' build.id step.stepnr) %]">log</a>)
[% END %]
</td>
</tr>
[% END %]

View file

@ -47,7 +47,6 @@ sub doBuild {
print STDERR "$_";
next;
}
print STDERR "GOT $_";
if (/^@\s+build-started\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/) {
$db->txn_do(sub {
@ -64,9 +63,9 @@ sub doBuild {
});
}
if (/^@\s+build-succeeded\s+(\S+)\s+(\S+)$/) {
elsif (/^@\s+build-succeeded\s+(\S+)\s+(\S+)$/) {
my $drvPath = $1;
$db->txn_do(sub {
my $drvPath = $1;
(my $step) = $db->resultset('Buildsteps')->search(
{id => $build->id, type => 0, drvpath => $drvPath}, {});
die unless $step;
@ -77,9 +76,9 @@ sub doBuild {
});
}
if (/^@\s+build-failed\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
elsif (/^@\s+build-failed\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
my $drvPath = $1;
$db->txn_do(sub {
my $drvPath = $1;
(my $step) = $db->resultset('Buildsteps')->search(
{id => $build->id, type => 0, drvpath => $drvPath}, {});
if ($step) {
@ -106,6 +105,51 @@ sub doBuild {
}
});
}
elsif (/^@\s+substituter-started\s+(\S+)\s+(\S+)$/) {
my $outPath = $1;
$db->txn_do(sub {
$db->resultset('Buildsteps')->create(
{ id => $build->id
, stepnr => $buildStepNr++
, type => 1 # = substitution
, outpath => $1
, busy => 1
, starttime => time
});
});
}
elsif (/^@\s+substituter-succeeded\s+(\S+)$/) {
my $outPath = $1;
$db->txn_do(sub {
(my $step) = $db->resultset('Buildsteps')->search(
{id => $build->id, type => 1, outpath => $outPath}, {});
die unless $step;
$step->busy(0);
$step->status(0);
$step->stoptime(time);
$step->update;
});
}
elsif (/^@\s+substituter-failed\s+(\S+)\s+(\S+)\s+(\S+)$/) {
my $outPath = $1;
$db->txn_do(sub {
(my $step) = $db->resultset('Buildsteps')->search(
{id => $build->id, type => 1, outpath => $outPath}, {});
die unless $step;
$step->busy(0);
$step->status(1);
$step->errormsg($3);
$step->stoptime(time);
$step->update;
});
}
else {
print STDERR "unknown Nix trace message: $_";
}
}
close OUT;