* Move NARs from the NixChannel controller to the Root controller and

drop the "/nix/store".  I.e. instead of

    http://hydra.nixos.org/jobset/nixpkgs/trunk/channel/latest/nar/nix/store/99djmii6l4yw9gn07zxqabh8z58pp84c-libmspack-0.0.20040308alpha.drv 

  we now have

    http://hydra.nixos.org/nar/99djmii6l4yw9gn07zxqabh8z58pp84c-libmspack-0.0.20040308alpha.drv 

  The main reason is that this is much faster, since we don't need to
  get all the channel data (which isn't used anyway for NAR
  generation).  This speeds up downloading a NAR from the Nixpkgs
  channel by > 2 seconds.

* Drop "Hydra::View::" from view names to get rid of an ugly warning.
This commit is contained in:
Eelco Dolstra 2010-06-22 12:00:19 +00:00
parent dfd8b4406d
commit e35f0005e6
4 changed files with 24 additions and 25 deletions

View file

@ -9,7 +9,7 @@ use Hydra::Helper::CatalystUtils;
sub closure : Chained('nix') PathPart {
my ($self, $c) = @_;
$c->stash->{current_view} = 'Hydra::View::NixClosure';
$c->stash->{current_view} = 'NixClosure';
# !!! quick hack; this is to make HEAD requests return the right
# MIME type. This is set in the view as well, but the view isn't
@ -20,25 +20,8 @@ sub closure : Chained('nix') PathPart {
sub manifest : Chained('nix') PathPart("MANIFEST") Args(0) {
my ($self, $c) = @_;
$c->stash->{current_view} = 'Hydra::View::NixManifest';
$c->stash->{narBase} = $c->uri_for($self->action_for("nar"), $c->req->captures);
}
sub nar : Chained('nix') PathPart {
my ($self, $c, @rest) = @_;
my $path .= "/" . join("/", @rest);
if (!isValidPath($path)) {
$c->response->status(410); # "Gone"
error($c, "Path " . $path . " is no longer available.");
}
# !!! check that $path is in the closure of $c->stash->{storePaths}.
$c->stash->{current_view} = 'Hydra::View::NixNAR';
$c->stash->{storePath} = $path;
$c->stash->{current_view} = 'NixManifest';
$c->stash->{narBase} = $c->uri_for($c->controller('Root')->action_for("nar"));
}
@ -54,7 +37,7 @@ sub pkg : Chained('nix') PathPart Args(1) {
$c->stash->{manifestUri} = $c->uri_for($self->action_for("manifest"), $c->req->captures);
$c->stash->{current_view} = 'Hydra::View::NixPkg';
$c->stash->{current_view} = 'NixPkg';
$c->response->content_type('application/nix-package');
}
@ -62,7 +45,7 @@ sub pkg : Chained('nix') PathPart Args(1) {
sub nixexprs : Chained('nix') PathPart('nixexprs.tar.bz2') Args(0) {
my ($self, $c) = @_;
$c->stash->{current_view} = 'Hydra::View::NixExprs';
$c->stash->{current_view} = 'NixExprs';
}

View file

@ -266,7 +266,7 @@ sub runtimedeps : Chained('build') PathPart('runtime-deps') {
notFound($c, "Path " . $build->outpath . " is no longer available.")
unless isValidPath($build->outpath);
$c->stash->{current_view} = 'Hydra::View::NixDepGraph';
$c->stash->{current_view} = 'NixDepGraph';
$c->stash->{storePaths} = [$build->outpath];
$c->res->content_type('image/png'); # !!!
@ -281,7 +281,7 @@ sub buildtimedeps : Chained('build') PathPart('buildtime-deps') {
notFound($c, "Path " . $build->drvpath . " is no longer available.")
unless isValidPath($build->drvpath);
$c->stash->{current_view} = 'Hydra::View::NixDepGraph';
$c->stash->{current_view} = 'NixDepGraph';
$c->stash->{storePaths} = [$build->drvpath];
$c->res->content_type('image/png'); # !!!

View file

@ -158,4 +158,19 @@ sub end : ActionClass('RenderView') {
}
sub nar :Local :Args(1) {
my ($self, $c, $path) = @_;
$path = "/nix/store/$path";
if (!isValidPath($path)) {
$c->response->status(410); # "Gone"
error($c, "Path " . $path . " is no longer available.");
}
$c->stash->{current_view} = 'NixNAR';
$c->stash->{storePath} = $path;
}
1;

View file

@ -26,11 +26,12 @@ sub process {
# Escape the characters that are allowed to appear in a Nix
# path name but have special meaning in a URI.
my $escaped = $path;
$escaped =~ s/^.*\///; # remove /nix/store/
$escaped =~ s/\+/%2b/g;
$escaped =~ s/\=/%3d/g;
$escaped =~ s/\?/%3f/g;
my $url = $c->stash->{narBase} . $escaped;
my $url = $c->stash->{narBase} . "/" . $escaped;
$manifest .=
"{\n" .