[devscripts] 03/05: Avoid prepending ./ to filenames in tar files when repacking zip file
Joachim Breitner
nomeata at moszumanska.debian.org
Fri Mar 21 15:58:36 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 75bf9bccbe6a30d06c75e581303ad47b988ae7b2
Author: Joachim Breitner <nomeata at debian.org>
Date: Fri Mar 21 16:44:27 2014 +0100
Avoid prepending ./ to filenames in tar files when repacking zip file
---
scripts/uscan.pl | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index c644299..a704258 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1488,7 +1488,18 @@ 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");
- spawn(exec => ['tar', '--owner=root', '--group=root', '--mode=a+rX', '--create', '--file', "$absdestdir/$compress_file_base", '--directory', $tempdir, '.'],
+
+ # Figure out the top-level contents of the tarball.
+ # If we'd pass "." to tar we'd get the same contents, but the filenames would
+ # start with ./, which is confusing later.
+ # This should also be more reliable than, say, changing directories and globbing.
+ opendir(TMPDIR, $tempdir) || uscan_die("Can't open $tempdir $!\n");
+ my @files = grep {$_ ne "." && $_ ne ".."} readdir(TMPDIR);
+ close TMPDIR;
+
+
+ # tar it all up
+ spawn(exec => ['tar', '--owner=root', '--group=root', '--mode=a+rX', '--create', '--file', "$absdestdir/$compress_file_base", '--directory', $tempdir, @files],
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");
--
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