[devscripts] 02/05: Devscripts::Compression: Add support for .zip/.Z files
James McCoy
jamessan at debian.org
Wed May 28 04:20:05 UTC 2014
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit 0f771df8868575522669f4558a74231162db7097
Author: James McCoy <jamessan at debian.org>
Date: Tue May 27 22:52:12 2014 -0400
Devscripts::Compression: Add support for .zip/.Z files
Shadow Dpkg::Compression's compression_get_property in order to easily
support extracting .zip/.Z files.
Signed-off-by: James McCoy <jamessan at debian.org>
---
Devscripts/Compression.pm | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/Devscripts/Compression.pm b/Devscripts/Compression.pm
index 5cb08a2..2e4c700 100644
--- a/Devscripts/Compression.pm
+++ b/Devscripts/Compression.pm
@@ -16,7 +16,7 @@
package Devscripts::Compression;
-use Dpkg::Compression;
+use Dpkg::Compression qw(!compression_get_property);
use Dpkg::IPC;
use Exporter qw(import);
@@ -46,6 +46,8 @@ my %mime2comp = (
"application/bzip2 " => "bzip2",
"application/x-xz" => "xz",
"application/xz" => "xz",
+ "application/zip" => "zip",
+ "application/x-compress" => "compress",
);
sub compression_guess_from_file {
@@ -62,4 +64,31 @@ sub compression_guess_from_file {
}
}
+# comp_prog and default_level aren't provided because a) they aren't needed in
+# devscripts and b) the Dpkg::Compression API isn't rich enough to support
+# these as compressors
+my %comp_properties = (
+ compress => {
+ file_ext => 'Z',
+ decomp_prog => ['uncompress'],
+ },
+ zip => {
+ file_ext => 'zip',
+ decomp_prog => ['unzip'],
+ }
+);
+
+sub compression_get_property
+{
+ my ($compression, $property) = @_;
+ if (!exists $comp_properties{$compression}) {
+ return Dpkg::Compression::compression_get_property($compression, $property);
+ }
+
+ if (exists $comp_properties{$compression}{$property}) {
+ return $comp_properties{$compression}{$property};
+ }
+ return;
+}
+
1;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list