Hi Otavio,

Otavio Salvador escreveu isso aí:
> Antonio Terceiro <[EMAIL PROTECTED]> writes:
> 
> Hello Terceiro,
> 
> How you've been?

Nice, hope you are doing well too. :)

> > * I added unzip package in "Recommends:"
> 
> I personally think that few people will be using this and then I think
> unzip could be a suggestion and not a recommendation. It would also be
> nice if it informs the user that the package unzip need to be
> installed if it's missing.

You're right. unzip should be a suggestion just like the other tons of
packages listed in Suggests:.

I've attached an updated patch, then.

Thanks,

-- 
Antonio Terceiro <[EMAIL PROTECTED]>
http://people.softwarelivre.org/~terceiro/
GnuPG ID: 0F9CB28F


Index: debian/control
===================================================================
--- debian/control	(revisão 904)
+++ debian/control	(cópia de trabalho)
@@ -25,7 +25,7 @@
  libfile-desktopentry-perl, libsoap-lite-perl, libterm-size-perl,
  libtimedate-perl, liburi-perl, libwww-perl, lintian | linda, lsb-release,
  mailx | mailutils, man-db, mutt, patch, patchutils, ssh, strace,
- wdiff, www-browser
+ wdiff, www-browser, unzip
 Description: Scripts to make the life of a Debian Package maintainer easier
  Contains the following scripts, dependencies/recommendations shown in
  brackets afterwards:
Index: scripts/uscan.1
===================================================================
--- scripts/uscan.1	(revisão 904)
+++ scripts/uscan.1	(cópia de trabalho)
@@ -361,10 +361,11 @@
 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).
+The unzip package is needed to repack .zip archives.
 .TP
 .B \-\-no\-symlink
 Don't make these symlinks and don't rename the files.
Index: scripts/uscan.pl
===================================================================
--- scripts/uscan.pl	(revisão 904)
+++ scripts/uscan.pl	(cópia de trabalho)
@@ -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,21 @@
 	$newfile_base = $newfile_base_gz;
     }
 
+    if ($repack and $newfile_base =~ /^(.*)\.zip$/) {
+	print "-- Repacking from zip to .tar.gz\n" if $verbose;
+
+	#check for unzip binary
+	system('which unzip > /dev/null') == 0
+	  or die("unzip binary not found. You need to install the package unzip to be able to repack .zip upstream archives.\n");
+
+	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: %%;

Reply via email to