* hydra: add dependency list with links to logfiles

This commit is contained in:
Rob Vermaas 2010-01-22 13:31:59 +00:00
parent 7315480acd
commit b615135825
3 changed files with 88 additions and 3 deletions

View file

@ -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) = @_;

View file

@ -132,7 +132,7 @@
<td>
<tt>[% build.drvpath %]</tt>
[% IF drvAvailable %]
(<a href="[% c.uri_for('/build' build.id 'buildtime-deps') %]">build-time dependencies</a>)
(build-time dependencies: <a href="[% c.uri_for('/build' build.id 'buildtime-deps') %]">graph</a> | <a href="[% c.uri_for('/build' build.id 'deps') %]#buildtime">list</a>)
[% END %]
</td>
</tr>
@ -141,7 +141,7 @@
<td>
<tt>[% build.outpath %]</tt>
[% IF available %]
(<a href="[% c.uri_for('/build' build.id 'runtime-deps') %]">runtime dependencies</a>)
(runtime dependencies: <a href="[% c.uri_for('/build' build.id 'runtime-deps') %]">graph</a> | <a href="[% c.uri_for('/build' build.id 'deps') %]#runtime">list</a>)
[% END %]
</td>
</tr>

46
src/root/deps.tt Normal file
View file

@ -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 %]
<a name="runtime"></a>
[% IF available %]
<h1>Runtime dependencies for [% build.outpath %]</h1>
<ul>
[% FOREACH dep IN runtimedeps -%]
<li>
[% IF dep.buildstep %]
<a href="[% c.uri_for('/build' dep.buildstep.get_column('build') 'nixlog' dep.buildstep.stepnr) %]">[% dep.path %]</a>
[% ELSE %]
[% dep.path %]
[% END %]
</li>
[% END %]
</ul>
[% ELSE %]
Path not available anymore!<br />
[% END %]
<a name="buildtime"></a>
[% IF drvAvailable %]
<h1>Build time dependencies for [% build.drvpath %]</h1>
<ul>
[% FOREACH dep IN buildtimedeps -%]
<li>
[% IF dep.buildstep %]
<a href="[% c.uri_for('/build' dep.buildstep.get_column('build') 'nixlog' dep.buildstep.stepnr) %]">[% dep.path %]</a>
[% ELSE %]
[% dep.path %]
[% END %]
</li>
[% END %]
</ul>
[% ELSE %]
Derivation not available anymore!<br />
[% END %]
[% END %]