Package: devscripts
Version: 2.10.12
Followup-For: Bug #456587
Find attached to this message a patch that implements repacking of zip
archives in uscan.
Notes:
* I tried to update every piece of documentation that mentioned .tar.bz2
to include zip also in both script and manpage.
* I added unzip package in "Recommends:"
* patch was made against devscripts from svn thanks to debcheckout
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-1-686 (SMP w/1 CPU core)
Locale: LANG=pt_BR.utf8, LC_CTYPE=pt_BR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages devscripts depends on:
ii debianutils 2.28.2 Miscellaneous utilities specific t
ii dpkg-dev 1.14.15 package building tools for Debian
ii libc6 2.7-5 GNU C Library: Shared libraries
ii perl 5.8.8-12 Larry Wall's Practical Extraction
ii sed 4.1.5-5 The GNU sed stream editor
Versions of packages devscripts recommends:
ii fakeroot 1.9 Gives a fake root environment
-- no debconf information
--
Antonio Terceiro <[EMAIL PROTECTED]>
http://people.softwarelivre.org/~terceiro/
GnuPG ID: 0F9CB28F
Index: debian/control
===================================================================
--- debian/control (revision 904)
+++ debian/control (working copy)
@@ -17,7 +17,7 @@
kdesdk-scripts (<< 4:3.5.6-2)
Depends: dpkg-dev, debianutils (>= 2.0), perl (>= 5.8), sed (>= 2.95),
${shlibs:Depends}, ${misc:Depends}
-Recommends: fakeroot
+Recommends: fakeroot, unzip
Suggests: devscripts-el, at, build-essential, curl | wget, cvs-buildpackage,
cvs | subversion | svk | tla | bzr | git-core | mercurial, dctrl-tools,
debian-keyring, debian-maintainers, dupload (>=2.1) | dput,
Index: scripts/uscan.1
===================================================================
--- scripts/uscan.1 (revision 904)
+++ scripts/uscan.1 (working copy)
@@ -361,10 +361,10 @@
and similarly for tar.bz2 files.
.TP
.B \-\-repack
-After having downloaded a bzip tar 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 a bzip tar archive (i.e. it doesn't
-match a .tbz, .tbz2, or .tar.bz2 extension)
+After having downloaded a 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 a bzip tar archive or a
+zip archive (i.e. it doesn't match a .tbz, .tbz2, .tar.bz2 or zip extension)
.TP
.B \-\-no\-symlink
Don't make these symlinks and don't rename the files.
Index: scripts/uscan.pl
===================================================================
--- scripts/uscan.pl (revision 904)
+++ scripts/uscan.pl (working copy)
@@ -89,7 +89,8 @@
--symlink Make an orig.tar.gz symlink to downloaded file (default)
--rename Rename to orig.tar.gz instead of symlinking
(Both will use orig.tar.bz2 if appropriate)
- --repack Repack downloaded archives from orig.tar.bz2 to orig.tar.gz
+ --repack Repack downloaded archives from orig.tar.bz2 or orig.zip to
+ orig.tar.gz
(does nothing if downloaded archive orig.tar.gz)
--no-symlink Don\'t make symlink or rename
--verbose Give verbose output
@@ -152,7 +153,7 @@
my $download = 1;
my $force_download = 0;
my $report = 0; # report even on up-to-date packages?
-my $repack = 0; # repack .tar.bz2 to .tar.gz
+my $repack = 0; # repack .tar.bz2 or .zip to .tar.gz
my $symlink = 'symlink';
my $verbose = 0;
my $check_dirname_level = 1;
@@ -1136,6 +1137,16 @@
$newfile_base = $newfile_base_gz;
}
+ if ($repack and $newfile_base =~ /^(.*)\.zip$/) {
+ print "-- Repacking from zip to .tar.gz\n" if $verbose;
+ my $newfile_base_tar_gz = "$1.tar.gz";
+ my $tmpdir = "$destdir/tmp.uscan.$$";
+ system("mkdir $tmpdir && unzip -q -d $tmpdir $destdir/$newfile_base && (cd $tmpdir ; tar czf ../$newfile_base_tar_gz *) && rm -rf $tmpdir") == 0
+ or die("Repacking from zip to tar.gz failed\n");
+ unlink "$destdir/$newfile_base";
+ $newfile_base = $newfile_base_tar_gz;
+ }
+
if ($newfile_base =~ /\.(tar\.gz|tgz|tar\.bz2|tbz2?)$/) {
my $filetype = `file $destdir/$newfile_base`;
$filetype =~ s%^\.\./\Q$newfile_base\E: %%;