* Nix now stores logs by default as bzip2, make sure the build page uncompresses before showing.

This commit is contained in:
Rob Vermaas 2012-06-25 15:05:16 +02:00
parent 209c51ca6c
commit 2aa52131ac

View file

@ -30,6 +30,10 @@ sub build : Chained('/') PathPart CaptureArgs(1) {
$c->stash->{project} = $c->stash->{build}->project;
}
sub cat_log_command {
my ($path) = @_;
return ($path =~ /.bz2$/ ? "cat $path | bzip2 -d" : "cat $path");
}
sub view_build : Chained('build') PathPart('') Args(0) {
my ($self, $c) = @_;
@ -43,9 +47,11 @@ sub view_build : Chained('build') PathPart('') Args(0) {
$c->stash->{pathHash} = $c->stash->{available} ? queryPathHash($build->outpath) : undef;
my $pipestart;
if (!$build->finished && $build->busy) {
my $logfile = $build->logfile;
$c->stash->{logtext} = `cat $logfile` if defined $logfile && -e $logfile;
$pipestart = cat_log_command($logfile);
$c->stash->{logtext} = `$pipestart` if defined $logfile && -e $logfile;
}
if ($build->finished && $build->iscachedbuild) {
@ -56,7 +62,8 @@ sub view_build : Chained('build') PathPart('') Args(0) {
(my $lastBuildStep) = $build->buildsteps->search({},{order_by => "stepnr DESC", rows => 1});
my $path = defined $lastBuildStep ? $lastBuildStep->logfile : "" ;
if ($build->finished && ($build->buildstatus == 1 || $build->buildstatus == 6) && !($path eq "") && -f $lastBuildStep->logfile) {
my $logtext = `tail -n 50 $path`;
$pipestart = cat_log_command($path);
my $logtext = `$pipestart | tail -n 50`;
$c->stash->{logtext} = removeAsciiEscapes($logtext);
}