From b6151358251aba000fbe0350cfcbdd19e20f2490 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Fri, 22 Jan 2010 13:31:59 +0000 Subject: [PATCH] * hydra: add dependency list with links to logfiles --- src/lib/Hydra/Controller/Build.pm | 41 ++++++++++++++++++++++++++- src/root/build.tt | 4 +-- src/root/deps.tt | 46 +++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 src/root/deps.tt diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index fcd85dce..72e84280 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -7,7 +7,7 @@ use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; use Hydra::Helper::AddBuilds; use File::stat; - +use Data::Dump qw(dump); sub build : Chained('/') PathPart CaptureArgs(1) { my ($self, $c, $id) = @_; @@ -253,6 +253,45 @@ sub buildtimedeps : Chained('build') PathPart('buildtime-deps') { $c->res->content_type('image/png'); # !!! } +sub deps : Chained('build') PathPart('deps') { + my ($self, $c) = @_; + + my $build = $c->stash->{build}; + $c->stash->{available} = isValidPath $build->outpath; + $c->stash->{drvAvailable} = isValidPath $build->drvpath; + + my $drvpath = $build->drvpath; + my $outpath = $build->outpath; + + my @buildtimepaths = (); + my @buildtimedeps = (); + @buildtimepaths = split '\n', `nix-store --query --requisites --include-outputs $drvpath` if isValidPath($build->drvpath); + + my @runtimepaths = (); + my @runtimedeps = (); + @runtimepaths = split '\n', `nix-store --query --requisites --include-outputs $outpath` if isValidPath($build->outpath); + + foreach my $p (@buildtimepaths) { + my $buildStep; + ($buildStep) = $c->model('DB::BuildSteps')->search({ outpath => $p }, {}) ; + my %dep = ( buildstep => $buildStep, path => $p ) ; + push(@buildtimedeps, \%dep); + } + + foreach my $p (@runtimepaths) { + my $buildStep; + ($buildStep) = $c->model('DB::BuildSteps')->search({ outpath => $p }, {}) ; + my %dep = ( buildstep => $buildStep, path => $p ) ; + push(@runtimedeps, \%dep); + } + + + $c->stash->{buildtimedeps} = \@buildtimedeps; + $c->stash->{runtimedeps} = \@runtimedeps; + + $c->stash->{template} = 'deps.tt'; +} + sub nix : Chained('build') PathPart('nix') CaptureArgs(0) { my ($self, $c) = @_; diff --git a/src/root/build.tt b/src/root/build.tt index 8a279ddb..ab448acb 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -132,7 +132,7 @@ [% build.drvpath %] [% IF drvAvailable %] - (build-time dependencies) + (build-time dependencies: graph | list) [% END %] @@ -141,7 +141,7 @@ [% build.outpath %] [% IF available %] - (runtime dependencies) + (runtime dependencies: graph | list) [% END %] diff --git a/src/root/deps.tt b/src/root/deps.tt new file mode 100644 index 00000000..0e56f04a --- /dev/null +++ b/src/root/deps.tt @@ -0,0 +1,46 @@ +[% WRAPPER layout.tt title="Job ‘$project.name:$jobset.name:$job.name’ build $id" %] +[% PROCESS common.tt %] +[% USE HTML %] + +[% project = build.project %] +[% jobset = build.jobset %] +[% job = build.job %] + + +[% IF available %] +

Runtime dependencies for [% build.outpath %]

+ +[% ELSE %] +Path not available anymore!
+[% END %] + + +[% IF drvAvailable %] +

Build time dependencies for [% build.drvpath %]

+ +[% ELSE %] +Derivation not available anymore!
+[% END %] + +[% END %] +