* Move everything up one directory.

This commit is contained in:
Eelco Dolstra
2009-03-05 13:41:57 +00:00
parent 6de278754a
commit 97ed2052ba
84 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package Hydra::View::NixClosure;
use strict;
use base qw/Catalyst::View/;
use IO::Pipe;
sub process {
my ($self, $c) = @_;
$c->response->content_type('application/x-nix-export');
my @storePaths = @{$c->stash->{storePaths}};
open(OUTPUT, "nix-store --export `nix-store -qR @storePaths` | gzip |");
my $fh = new IO::Handle;
$fh->fdopen(fileno(OUTPUT), "r") or die;
$c->response->body($fh);
return 1;
}
1;

View File

@ -0,0 +1,24 @@
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;

View File

@ -0,0 +1,59 @@
package Hydra::View::NixExprs;
use strict;
use base qw/Catalyst::View/;
use Hydra::Helper::Nix;
use Archive::Tar;
use IO::Compress::Bzip2 qw(bzip2);
sub escape {
my ($s) = @_;
$s =~ s|\\|\\\\|g;
$s =~ s|\"|\\\"|g;
$s =~ s|\$|\\\$|g;
return "\"" . $s . "\"";
}
sub process {
my ($self, $c) = @_;
my $res = "[\n";
foreach my $name (keys %{$c->stash->{nixPkgs}}) {
my $build = $c->stash->{nixPkgs}->{$name};
$res .= " # $name\n";
$res .= " { type = \"derivation\";\n";
$res .= " name = " . escape ($build->resultInfo->releasename or $build->nixname) . ";\n";
$res .= " system = " . (escape $build->system) . ";\n";
$res .= " outPath = " . $build->outpath . ";\n";
$res .= " meta = {\n";
$res .= " description = " . (escape $build->description) . ";\n"
if $build->description;
$res .= " longDescription = " . (escape $build->longdescription) . ";\n"
if $build->longdescription;
$res .= " license = " . (escape $build->license) . ";\n"
if $build->license;
$res .= " };\n";
$res .= " }\n";
}
$res .= "]\n";
my $tar = Archive::Tar->new;
$tar->add_data("channel/channel-name", ($c->stash->{channelName} or "unnamed-channel"), {mtime => 0});
$tar->add_data("channel/default.nix", $res, {mtime => 0});
my $tardata = $tar->write;
my $bzip2data;
bzip2(\$tardata => \$bzip2data);
$c->response->content_type('application/x-bzip2');
$c->response->body($bzip2data);
return 1;
}
1;

View File

@ -0,0 +1,43 @@
package Hydra::View::NixManifest;
use strict;
use base qw/Catalyst::View/;
use Hydra::Helper::Nix;
sub process {
my ($self, $c) = @_;
my @storePaths = @{$c->stash->{storePaths}};
$c->response->content_type('text/x-nix-manifest');
my @paths = split '\n', `nix-store --query --requisites @storePaths`;
die "cannot query dependencies of path(s) @storePaths: $?" if $? != 0;
my $manifest =
"version {\n" .
" ManifestVersion: 4\n" .
"}\n";
foreach my $path (@paths) {
my ($hash, $deriver, $refs) = queryPathInfo $path;
my $url = $c->stash->{narBase} . $path;
$manifest .=
"{\n" .
" StorePath: $path\n" .
(scalar @{$refs} > 0 ? " References: @{$refs}\n" : "") .
(defined $deriver ? " Deriver: $deriver\n" : "") .
" NarURL: $url\n" .
" NarHash: $hash\n" .
"}\n";
}
$c->response->body($manifest);
return 1;
}
1;

View File

@ -0,0 +1,25 @@
package Hydra::View::NixNAR;
use strict;
use base qw/Catalyst::View/;
sub process {
my ($self, $c) = @_;
my $storePath = $c->stash->{storePath};
$c->response->content_type('application/x-nix-archive'); # !!! check MIME type
open(OUTPUT, "nix-store --dump '$storePath' | bzip2 |");
my $fh = new IO::Handle;
$fh->fdopen(fileno(OUTPUT), "r") or die;
$c->response->body($fh);
undef $fh;
return 1;
}
1;

View File

@ -0,0 +1,22 @@
package Hydra::View::NixPkg;
use strict;
use base qw/Catalyst::View/;
sub process {
my ($self, $c) = @_;
$c->response->content_type('application/nix-package');
my $build = $c->stash->{build};
my $s = "NIXPKG1 " . $c->stash->{manifestUri}
. " " . $build->nixname . " " . $build->system
. " " . $build->drvpath . " " . $build->outpath;
$c->response->body($s);
return 1;
}
1;

8
src/lib/Hydra/View/TT.pm Normal file
View File

@ -0,0 +1,8 @@
package Hydra::View::TT;
use strict;
use base 'Catalyst::View::TT';
__PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
1;