* Downloading closures.
[?]
Nov 18, 2008, 2:48 PM
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HACDependencies
- [2]
IK53RV4V - [3]
J5UVLXOK* Start of a basic Catalyst web interface. - [4]
L5VIEXSC* Allow downloading of build products. - [5]
MOCEUXZA* Support serving products that are directories (such as manuals or - [*]
B72GLND4 - [*]
W6DC6K4I* Happy Javascript hacking. - [*]
UVMFS73T* Some jQuery / CSS hackery.
Change contents
- edit in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 6
use HydraFrontend::Helper::Nix; - replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 395
return error($c, "Not yet implemented.");return error($c, "Product is not a Nix build.") if $product->type ne "nix-build";return error($c, "Path " . $product->path . " is no longer available.") unless HydraFrontend::Helper::Nix::isValidPath($product->path);$c->stash->{current_view} = 'HydraFrontend::View::NixClosure';$c->stash->{storePath} = $product->path;$c->stash->{name} = $build->nixname; - file addition: Helper[3.753]
- file addition: Nix.pm[0.416]
package HydraFrontend::Helper::Nix;use strict;sub isValidPath {my $path = shift;$SIG{CHLD} = 'DEFAULT'; # !!! work around system() failing if SIGCHLD is ignoredreturn system("nix-store --check-validity $path") == 0;}1; - file addition: NixClosure.pm[3.6771]
package HydraFrontend::View::NixClosure;use strict;use base qw/Catalyst::View/;use IO::Pipe;use POSIX qw(dup2);sub process {my ( $self, $c ) = @_;$c->response->content_type('application/x-nix-export');$c->response->header('Content-Disposition' => 'attachment; filename=' . $c->stash->{name} . '.closure.gz');my $storePath = $c->stash->{storePath};open(OUTPUT, "nix-store --export `nix-store -qR $storePath` | gzip |");my $fh = new IO::Handle;$fh->fdopen(fileno(OUTPUT), "r") or die;$c->response->body($fh);return 1;}1; - replacement in src/HydraFrontend/lib/HydraFrontend.pm at line 16
__PACKAGE__->config( name => 'HydraFrontend' );__PACKAGE__->config(name => 'HydraFrontend',default_view => "TT"); - edit in src/HydraFrontend/root/build.tt at line 3
[% USE HTML %] - edit in src/HydraFrontend/root/build.tt at line 209
[<a class="productDetailsToggle" href="javascript:">help</a>]<div class="help productDetails"><p>If you have Nix installed on your machine, this build and allits dependencies can be unpacked into your local Nix store bydoing:</p><pre>$ gunzip < [% HTML.escape(build.nixname) %].closure.gz | nix-store --import</pre>or to download and unpack in one command:<pre>$ curl [% c.uri_for('/closure' build.id product.productnr) %] | gunzip | nix-store --import</pre><p>The package can then be found in the path <tt>[%product.path %]</tt>. If you get the error message “importedarchive lacks a signature”, you should make sure that you havesufficient access rights to the Nix store, e.g., run thecommand as <tt>root</tt>.</p></div> - edit in src/HydraFrontend/root/hydra.css at line 208
div.help {border: solid black 1px;padding-left: 1em;padding-right: 1em;} - edit in src/HydraFrontend/root/hydra.css at line 214[8.2026][9.251]
div.help pre {padding-left: 1.5em;color: #400000;}