[devscripts] 02/03: Unbreak zip repacking

Joachim Breitner nomeata at moszumanska.debian.org
Fri Mar 21 10:18:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

nomeata pushed a commit to branch master
in repository devscripts.

commit c5ac9056f396ce0009b9f8bcd628852e5a74eaa0
Author: Joachim Breitner <nomeata at debian.org>
Date:   Wed Mar 19 23:44:56 2014 +0100

    Unbreak zip repacking
    
    by recovering tar-calling code removed in 9a6ba47, and simplifiy it a bit.
---
 scripts/uscan.pl | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 7ece0e3..bd7b998 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1473,13 +1473,13 @@ EOF
     }
 
     if ($repack and $newfile_base =~ /^(.*)\.(zip|jar)$/) {
+	my $compress_file_base = "$1.tar" ;
         my $suffix = compression_get_property($repack_compression, "file_ext");
 	print "-- Repacking from zip to .tar.$suffix\n" if $verbose;
 
 	system('command -v unzip >/dev/null 2>&1') >> 8 == 0
 	  or uscan_die("unzip binary not found. You need to install the package unzip to be able to repack .zip upstream archives.\n");
 
-	my $compress_file_base = "$1.tar" ;
 	my $newfile_base_compression = "$compress_file_base.$suffix";
 	my $tempdir = tempdir ("uscanXXXX", TMPDIR => 1, CLEANUP => 1);
 	# Parent of the target directory should be under our control
@@ -1488,15 +1488,12 @@ EOF
 	my $absdestdir = abs_path($destdir);
 	system('unzip', '-q', '-a', '-d', $tempdir, "$destdir/$newfile_base") == 0
 	    or uscan_die("Repacking from zip or jar to tar.$suffix failed (could not unzip)\n");
-	my $cwd = cwd();
-	chdir($tempdir) or uscan_die("Unable to chdir($tempdir): $!\n");
-	eval {
-	    compress_archive("$absdestdir/$compress_file_base", "$absdestdir/$newfile_base_compression", $repack_compression);
-	};
-	if ($@) {
+        spawn(exec => ['tar', '--owner=root', '--group=root', '--mode=a+rX', '--create', '--file', "$absdestdir/$compress_file_base", '--directory', $tempdir, '.'],
+              wait_child => 1);
+        unless (-e "$absdestdir/$compress_file_base") {
 	    uscan_die("Repacking from zip or jar to tar.$suffix failed (could not create tarball)\n");
 	}
-	chdir($cwd);
+	compress_archive("$absdestdir/$compress_file_base", "$absdestdir/$newfile_base_compression", $repack_compression);
 	$newfile_base = $newfile_base_compression;
 
     } elsif ($repack) { # Repacking from tar to tar, so just change the compression

-- 
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