* Quick hack to allow viewing of dependency graphs (via nix-store -q

[?]
Feb 27, 2009, 3:31 PM
OD5FSS5AJ3XRTV5Q4UQQF6JMBT6UUL7UUOMPPUBNOM6ZMVIHW35QC

Dependencies

  • [2] 5NO7NCKT * Refactoring.
  • [3] J5UVLXOK * Start of a basic Catalyst web interface.
  • [4] LBNVQXUB * Build the /build stuff in a separate controller.
  • [5] L2E6EVE2 * Merged the Build and Job tables.
  • [6] WYN733ST * Store build duration, handle cached builds.
  • [*] PKPWUHUX * Idem.

Change contents

  • edit in src/Hydra/lib/Hydra/Controller/Build.pm at line 37
    [3.941]
    [3.941]
    $c->stash->{drvAvailable} = isValidPath $build->drvpath;
  • replacement in src/Hydra/lib/Hydra/Controller/Build.pm at line 92
    [3.2573][2.1177:1268]()
    error($c, "Product " . $product->path . " has disappeared.") unless -e $product->path;
    [3.2573]
    [3.2671]
    notFound($c, "Product " . $product->path . " has disappeared.") unless -e $product->path;
  • edit in src/Hydra/lib/Hydra/Controller/Build.pm at line 115
    [2.1410]
    [2.1410]
    sub runtimedeps : Chained('build') PathPart('runtime-deps') {
    my ($self, $c) = @_;
    my $build = $c->stash->{build};
    notFound($c, "Path " . $build->outpath . " is no longer available.")
    unless isValidPath($build->outpath);
    $c->stash->{current_view} = 'Hydra::View::NixDepGraph';
    $c->stash->{storePaths} = [$build->outpath];
    $c->response->content_type('image/png'); # !!!
    }
    sub buildtimedeps : Chained('build') PathPart('buildtime-deps') {
    my ($self, $c) = @_;
    my $build = $c->stash->{build};
    notFound($c, "Path " . $build->drvpath . " is no longer available.")
    unless isValidPath($build->drvpath);
    $c->stash->{current_view} = 'Hydra::View::NixDepGraph';
    $c->stash->{storePaths} = [$build->drvpath];
    $c->response->content_type('image/png'); # !!!
    }
  • file addition: NixDepGraph.pm (----------)
    [8.646]
    package Hydra::View::NixDepGraph;
    use strict;
    use base qw/Catalyst::View/;
    use IO::Pipe;
    sub process {
    my ($self, $c) = @_;
    $c->response->content_type('image/png');
    my @storePaths = @{$c->stash->{storePaths}};
    open(OUTPUT, "nix-store --query --graph @storePaths | dot -Tpng -Gbgcolor=transparent |");
    my $fh = new IO::Handle;
    $fh->fdopen(fileno(OUTPUT), "r") or die;
    $c->response->body($fh);
    return 1;
    }
    1;
  • replacement in src/Hydra/root/build.tt at line 89
    [3.5981][3.5981:6023]()
    <td><tt>[% build.drvpath %]</tt></td>
    [3.5981]
    [3.6023]
    <td>
    <tt>[% build.drvpath %]</tt>
    [% IF drvAvailable %]
    (<a href="[% c.uri_for('/build' build.id 'buildtime-deps') %]">build-time dependencies</a>)
    [% END %]
    </td>
  • replacement in src/Hydra/root/build.tt at line 98
    [3.6070][3.6070:6112]()
    <td><tt>[% build.outpath %]</tt></td>
    [3.6070]
    [3.1470]
    <td>
    <tt>[% build.outpath %]</tt>
    [% IF available %]
    (<a href="[% c.uri_for('/build' build.id 'runtime-deps') %]">runtime dependencies</a>)
    [% END %]
    </td>