diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 0bdfbda5..d5c7d163 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -145,7 +145,6 @@ sub showLog { my ($c, $mode, $drvPath, @outPaths) = @_; my $logPath = findLog($c, $drvPath, @outPaths); - print STDERR "log = $logPath\n"; notFound($c, "The build log of derivation ‘$drvPath’ is not available.") unless defined $logPath; @@ -159,8 +158,12 @@ sub showLog { } elsif ($mode eq "raw") { - $c->stash->{'plain'} = { data => (scalar logContents($logPath)) || " " }; - $c->forward('Hydra::View::Plain'); + if ($logPath !~ /.bz2$/) { + $c->serve_static_file($logPath); + } else { + $c->stash->{'plain'} = { data => (scalar logContents($logPath)) || " " }; + $c->forward('Hydra::View::Plain'); + } } elsif ($mode eq "tail-reload") { diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index 64c9e26f..f9dc69e6 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -270,22 +270,22 @@ sub findLog { my ($c, $drvPath, @outPaths) = @_; if (defined $drvPath) { - my $logPath = getDrvLogPath($drvPath); - return $logPath if defined $logPath; + my $logPath = getDrvLogPath($drvPath); + return $logPath if defined $logPath; } return undef if scalar @outPaths == 0; my @steps = $c->model('DB::BuildSteps')->search( - { path => { -in => [@outPaths] } }, - { select => ["drvpath"] + { path => { -in => [@outPaths] } }, + { select => ["drvpath"] , distinct => 1 - , join => "buildstepoutputs" - }); + , join => "buildstepoutputs" + }); foreach my $step (@steps) { - my $logPath = getDrvLogPath($step->drvpath); - return $logPath if defined $logPath; + my $logPath = getDrvLogPath($step->drvpath); + return $logPath if defined $logPath; } return undef;