Hi again,

Here's an alternative patch that makes uscan(1)'s --repack command
only repack lzma tar and zip archives, since the archive contains
source packages that use .bz2, .gz, and .xz.

-- 
Matt Kraai
https://ftbfs.org/kraai
>From 7d393c880bc16ad6c86ba4a5d5addcf9534cfee2 Mon Sep 17 00:00:00 2001
From: Matt Kraai <kr...@debian.org>
Date: Sun, 13 Nov 2011 09:04:16 -0800
Subject: [PATCH] Make uscan not repack .bz2 and .xz archives

Signed-off-by: Matt Kraai <kr...@debian.org>
---
 scripts/uscan.1  |   14 ++++++--------
 scripts/uscan.pl |   26 ++++----------------------
 2 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/scripts/uscan.1 b/scripts/uscan.1
index 15e529a..4a093b6 100644
--- a/scripts/uscan.1
+++ b/scripts/uscan.1
@@ -374,14 +374,12 @@ Instead of symlinking, rename the downloaded files to their Debian
 \fIorig.tar.xz\fR names as described above.
 .TP
 .B \-\-repack
-After having downloaded an lzma tar, xz tar, bzip tar or zip archive,
-repack it to a gzip tar archive, which is still currently required as a
-member of a Debian source package. Does nothing if the downloaded
-archive is not an lzma tar archive, xz tar archive, bzip tar archive or
-a zip archive (i.e. it doesn't match a .tlz, .tlzm, .tlzma, .tar.lzma, .txz,
-\^.tar.xz .tbz, .tbz2, .tar.bz2 or .zip extension). The unzip package must be
-installed in order to repack .zip archives, the xz-utils package must be
-installed to repack lzma or xz tar archives.
+After having downloaded an lzma tar or zip archive, repack it to a gzip tar
+archive. Does nothing if the downloaded archive is not an lzma tar archive
+or a zip archive (i.e. it doesn't match a .tlz, .tlzm, .tlzma, .tar.lzma, or
+\^.zip extension). The unzip package must be installed in order to repack
+\^.zip archives, the xz-utils package must be installed to repack lzma tar
+archives.
 .TP
 .B \-\-no\-symlink
 Don't make these symlinks and don't rename the files.
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 58a8b3e..3fb3ff6 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -94,9 +94,9 @@ Options:
     --rename       Rename to orig.tar.gz instead of symlinking
                    (Both will use orig.tar.bz2, orig.tar.lzma, or orig.tar.xz
                    if appropriate)
-    --repack       Repack downloaded archives from orig.tar.bz2, orig.tar.lzma,
-                   orig.tar.xz or orig.zip to orig.tar.gz
-                   (does nothing if downloaded archive orig.tar.gz)
+    --repack       Repack downloaded archives from orig.tar.lzma or orig.zip
+                   to orig.tar.gz (does nothing if downloaded archive
+		   orig.tar.bz2, .orig.tar.gz, or .orig.tar.xz)
     --no-symlink   Don\'t make symlink or rename
     --verbose      Give verbose output
     --no-verbose   Don\'t give verbose output (default)
@@ -165,7 +165,7 @@ my $download = 1;
 my $download_version;
 my $force_download = 0;
 my $report = 0; # report even on up-to-date packages?
-my $repack = 0; # repack .tar.bz2, .tar.lzma, .tar.xz or .zip to .tar.gz
+my $repack = 0; # repack .tar.lzma or .zip to .tar.gz
 my $symlink = 'symlink';
 my $verbose = 0;
 my $check_dirname_level = 1;
@@ -1341,15 +1341,6 @@ EOF
 	}
     }
 
-    if ($repack and $newfile_base =~ /^(.*)\.(tar\.bz2|tbz2?)$/) {
-	print "-- Repacking from bzip2 to gzip\n" if $verbose;
-	my $newfile_base_gz = "$1.tar.gz";
-	system("bunzip2 -c $destdir/$newfile_base | gzip -n -9 > $destdir/$newfile_base_gz") == 0
-	  or die "repacking from bzip2 to gzip failed\n";
-	unlink "$destdir/$newfile_base";
-	$newfile_base = $newfile_base_gz;
-    }
-
     if ($repack and $newfile_base =~ /^(.*)\.(tar\.lzma|tlz(?:ma?)?)$/) {
 	print "-- Repacking from lzma to gzip\n" if $verbose;
 	my $newfile_base_gz = "$1.tar.gz";
@@ -1359,15 +1350,6 @@ EOF
 	$newfile_base = $newfile_base_gz;
     }
 
-    if ($repack and $newfile_base =~ /^(.*)\.(tar\.xz|txz)$/) {
-	print "-- Repacking from xz to gzip\n" if $verbose;
-	my $newfile_base_gz = "$1.tar.gz";
-	system("xz -cd $destdir/$newfile_base | gzip -n -9 > $destdir/$newfile_base_gz") == 0
-	  or die "repacking from xz to gzip failed\n";
-	unlink "$destdir/$newfile_base";
-	$newfile_base = $newfile_base_gz;
-    }
-
     if ($repack and $newfile_base =~ /^(.*)\.zip$/) {
 	print "-- Repacking from zip to .tar.gz\n" if $verbose;
 
-- 
1.7.7.2

Reply via email to