forked from lix-project/hydra
* Generate a .tar.bz2 file for the channel Nix expression, since
that's what nix-channel expects.
This commit is contained in:
parent
4d2cb75104
commit
8c7eb165c9
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
@ -38,9 +40,16 @@ 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue