[devscripts] 01/02: Forgot code for decompress_archive and compress_archive
Joachim Breitner
nomeata at moszumanska.debian.org
Sat Apr 12 22:20:15 UTC 2014
This is an automated email from the git hooks/post-receive script.
nomeata pushed a commit to branch mk-origtargz
in repository devscripts.
commit f4860c1805560f072100d6e81ec3a1aebd14f7b9
Author: Joachim Breitner <nomeata at debian.org>
Date: Sun Apr 13 00:10:18 2014 +0200
Forgot code for decompress_archive and compress_archive
---
scripts/mk-origtargz.pl | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/scripts/mk-origtargz.pl b/scripts/mk-origtargz.pl
index 4c21262..21ca70b 100755
--- a/scripts/mk-origtargz.pl
+++ b/scripts/mk-origtargz.pl
@@ -146,11 +146,15 @@ use File::Temp qw/tempdir/;
use Getopt::Long qw(:config gnu_getopt);
use Pod::Usage;
+use Dpkg::IPC;
use File::Temp qw/tempfile/;
use Devscripts::Compression qw/compression_is_supported compression_guess_from_file compression_get_property/;
use Cwd 'abs_path';
use File::Copy;
+sub decompress_archive($$);
+sub compress_archive($$$);
+
my $package = undef;
my $version = undef;
@@ -403,7 +407,7 @@ if (scalar @exclude_globs > 0) {
# Actually do the unpack, remove, pack cycle
if ($do_repack || $deletecount) {
- decompress_archive($destfile, $destfiletar);
+ decompress_archive($upstream_tar, $destfiletar);
spawn(exec => ['tar', '--delete', '--file', $destfiletar, @to_delete ]
,wait_child => 1) if (@to_delete);
compress_archive($destfiletar, $destfile, $compression);
@@ -444,3 +448,29 @@ if ($deletecount) {
print ".\n";
exit 0;
+
+sub decompress_archive($$) {
+ my ($from_file, $to_file) = @_;
+ my $comp = compression_guess_from_file($from_file);
+ unless ($comp) {
+ uscan_die("Cannot determine compression method of $from_file");
+ }
+
+ my $cmd = compression_get_property($comp, 'decomp_prog');
+ spawn(exec => $cmd,
+ from_file => $from_file,
+ to_file => $to_file,
+ wait_child => 1);
+}
+
+sub compress_archive($$$) {
+ my ($from_file, $to_file, $comp) = @_;
+
+ my $cmd = compression_get_property($comp, 'comp_prog');
+ push(@{$cmd}, '-'.compression_get_property($comp, 'default_level'));
+ spawn(exec => $cmd,
+ from_file => $from_file,
+ to_file => $to_file,
+ wait_child => 1);
+ unlink $from_file;
+}
--
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