diff --git a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm index 3afdbe55..8fac493e 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm @@ -139,6 +139,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; diff --git a/src/HydraFrontend/root/build.tt b/src/HydraFrontend/root/build.tt index 8ef44b8e..aa45c7af 100644 --- a/src/HydraFrontend/root/build.tt +++ b/src/HydraFrontend/root/build.tt @@ -147,7 +147,11 @@ [% step.stepnr %] - Build of [% step.outpath %] + [% IF step.type == 0 %] + Build of [% step.outpath %] + [% ELSE %] + Substitution of [% step.outpath %] + [% END %] [% IF step.busy == 0 %] @@ -164,7 +168,9 @@ [% ELSE %] Failed: [% step.errormsg %] [% END %] - (log) + [% IF step.logfile %] + (log) + [% END %] [% END %] diff --git a/src/build.pl b/src/build.pl index 3436e4d3..637bd19a 100644 --- a/src/build.pl +++ b/src/build.pl @@ -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;