From 6327edd63f0b673ce0748319799d279d0934a8ac Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Wed, 19 Feb 2014 10:21:59 +0000 Subject: [PATCH] Add a convenient way to get logs of a path/drv. Requested by phreedom. --- src/lib/Hydra/Controller/Root.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index eeb46452..cc02cbd3 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -349,5 +349,18 @@ sub search :Local Args(0) { } +sub log :Local :Args(1) { + my ($self, $c, $path) = @_; + + $path = ($ENV{NIX_STORE_DIR} || "/nix/store")."/$path"; + + my @outpaths = ($path); + my $logPath = findLog($c, $path, @outpaths); + notFound($c, "The build log of $path is not available.") unless defined $logPath; + + $c->stash->{'plain'} = { data => (scalar logContents($logPath)) || " " }; + $c->forward('Hydra::View::Plain'); +} + 1;