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) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{current_view} = 'Hydra::View::NixExprs';
|
$c->stash->{current_view} = 'Hydra::View::NixExprs';
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package Hydra::View::NixExprs;
|
||||||
use strict;
|
use strict;
|
||||||
use base qw/Catalyst::View/;
|
use base qw/Catalyst::View/;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
|
use Archive::Tar;
|
||||||
|
use IO::Compress::Bzip2 qw(bzip2);
|
||||||
|
|
||||||
|
|
||||||
sub escape {
|
sub escape {
|
||||||
|
@ -39,8 +41,15 @@ sub process {
|
||||||
|
|
||||||
$res .= "]\n";
|
$res .= "]\n";
|
||||||
|
|
||||||
$c->response->content_type('text/plain');
|
my $tar = Archive::Tar->new;
|
||||||
$c->response->body($res);
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue