* Generate a .tar.bz2 file for the channel Nix expression, since

that's what nix-channel expects.
This commit is contained in:
Eelco Dolstra 2009-03-03 10:44:54 +00:00
parent 4d2cb75104
commit 8c7eb165c9
2 changed files with 13 additions and 4 deletions

View file

@ -57,7 +57,7 @@ sub pkg : Chained('nix') PathPart Args(1) {
}
sub nixexprs : Chained('nix') PathPart Args(0) {
sub nixexprs : Chained('nix') PathPart('nixexprs.tar.bz2') Args(0) {
my ($self, $c) = @_;
$c->stash->{current_view} = 'Hydra::View::NixExprs';
}

View file

@ -3,6 +3,8 @@ 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 {
@ -39,8 +41,15 @@ sub process {
$res .= "]\n";
$c->response->content_type('text/plain');
$c->response->body($res);
my $tar = Archive::Tar->new;
$tar->add_data("channel/default.nix", $res);
my $tardata = $tar->write;
my $bzip2data;
bzip2(\$tardata => \$bzip2data);
$c->response->content_type('application/x-bzip2');
$c->response->body($bzip2data);
return 1;
}