From fe030331b58d86098eac990c0480748d64487317 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 Jul 2013 18:46:18 +0200 Subject: [PATCH] Revert "Don't compress already-compressed files." This reverts commit 190bffd846f044a13c239513f8ef1ea45ee8a1f2. --- src/lib/Hydra/View/NARInfo.pm | 3 +-- src/lib/Hydra/View/NixNAR.pm | 16 +--------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/lib/Hydra/View/NARInfo.pm b/src/lib/Hydra/View/NARInfo.pm index 8bfd0592..00dd6a68 100644 --- a/src/lib/Hydra/View/NARInfo.pm +++ b/src/lib/Hydra/View/NARInfo.pm @@ -2,7 +2,6 @@ package Hydra::View::NARInfo; use strict; use base qw/Catalyst::View/; -use Hydra::View::NixNAR; use File::Basename; use Nix::Store; @@ -18,7 +17,7 @@ sub process { my $info; $info .= "StorePath: $storePath\n"; $info .= "URL: nar/" . basename $storePath. "\n"; - $info .= "Compression: " . file_compression $storePath . "\n"; + $info .= "Compression: bzip2\n"; $info .= "NarHash: $narHash\n"; $info .= "NarSize: $narSize\n"; $info .= "References: " . join(" ", map { basename $_ } @{$refs}) . "\n"; diff --git a/src/lib/Hydra/View/NixNAR.pm b/src/lib/Hydra/View/NixNAR.pm index a403b42d..af1a5367 100644 --- a/src/lib/Hydra/View/NixNAR.pm +++ b/src/lib/Hydra/View/NixNAR.pm @@ -3,30 +3,16 @@ package Hydra::View::NixNAR; use strict; use base qw/Catalyst::View/; -sub file_compression { - my ($file) = $@_; - - if /\\.(gz|bz2|xz|lz|zip)/ - return "none"; - else - return "bzip2"; -} - sub process { my ($self, $c) = @_; my $storePath = $c->stash->{storePath}; - my $compression = file_compression($storePath); $c->response->content_type('application/x-nix-archive'); # !!! check MIME type - $c->response->content_length(-s $storePath) if ($compression == "none"); my $fh = new IO::Handle; - if ($compression == "none") - open $fh, "nix-store --dump '$storePath' |"; - else - open $fh, "nix-store --dump '$storePath' | bzip2 |"; + open $fh, "nix-store --dump '$storePath' | bzip2 |"; $c->response->body($fh);