Author: eelco
Date: 2010-06-22 12:00:19 +0000 (Tue, 22 Jun 2010)
New Revision: 22370

You can view the changes in this commit at:
   https://svn.nixos.org/viewvc/nix?rev=22370&view=rev

Modified:
   hydra/trunk/src/lib/Hydra/Base/Controller/NixChannel.pm
   hydra/trunk/src/lib/Hydra/Controller/Build.pm
   hydra/trunk/src/lib/Hydra/Controller/Root.pm
   hydra/trunk/src/lib/Hydra/View/NixManifest.pm

Log:
* 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.


Changes:

Modified: hydra/trunk/src/lib/Hydra/Base/Controller/NixChannel.pm
===================================================================
--- hydra/trunk/src/lib/Hydra/Base/Controller/NixChannel.pm     2010-06-22 
08:06:12 UTC (rev 22369)
+++ hydra/trunk/src/lib/Hydra/Base/Controller/NixChannel.pm     2010-06-22 
12:00:19 UTC (rev 22370)
@@ -9,7 +9,7 @@
 
 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,28 +20,11 @@
 
 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);
+    $c->stash->{current_view} = 'NixManifest';
+    $c->stash->{narBase} = 
$c->uri_for($c->controller('Root')->action_for("nar"));
 }
 
 
-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;
-}
-
-
 sub pkg : Chained('nix') PathPart Args(1) {
     my ($self, $c, $pkgName) = @_;
 
@@ -54,7 +37,7 @@
 
     $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 nixexprs : Chained('nix') PathPart('nixexprs.tar.bz2') Args(0) {
     my ($self, $c) = @_;
-    $c->stash->{current_view} = 'Hydra::View::NixExprs';
+    $c->stash->{current_view} = 'NixExprs';
 }
 
 

Modified: hydra/trunk/src/lib/Hydra/Controller/Build.pm
===================================================================
--- hydra/trunk/src/lib/Hydra/Controller/Build.pm       2010-06-22 08:06:12 UTC 
(rev 22369)
+++ hydra/trunk/src/lib/Hydra/Controller/Build.pm       2010-06-22 12:00:19 UTC 
(rev 22370)
@@ -266,7 +266,7 @@
     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 @@
     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'); # !!!

Modified: hydra/trunk/src/lib/Hydra/Controller/Root.pm
===================================================================
--- hydra/trunk/src/lib/Hydra/Controller/Root.pm        2010-06-22 08:06:12 UTC 
(rev 22369)
+++ hydra/trunk/src/lib/Hydra/Controller/Root.pm        2010-06-22 12:00:19 UTC 
(rev 22370)
@@ -158,4 +158,19 @@
 }
 
 
+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;

Modified: hydra/trunk/src/lib/Hydra/View/NixManifest.pm
===================================================================
--- hydra/trunk/src/lib/Hydra/View/NixManifest.pm       2010-06-22 08:06:12 UTC 
(rev 22369)
+++ hydra/trunk/src/lib/Hydra/View/NixManifest.pm       2010-06-22 12:00:19 UTC 
(rev 22370)
@@ -26,11 +26,12 @@
         # 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" .

_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to