Package: devscripts
Version: 2.10.73
Severity: normal
Tags: patch
User: devscri...@packages.debian.org
Usertags: uscan

Hi,

the fixes I sent for #615108 introduced a regression: the --destdir
option no longer works with relative paths. This is because we now cd
before calling tar, which breaks the relative path.

The attached patch remedies this by creating an absolute version of the
path for the tar-archiving command.


Regards,
Christian
From 8307bab639bd590b5fa7aa4ada5a5dbda311c808 Mon Sep 17 00:00:00 2001
From: Christian Kastner <deb...@kvr.at>
Date: Fri, 27 May 2011 00:21:18 +0200
Subject: [PATCH] Fix --destdir regression when repacking ZIP files

The --destdir option no longer worked with relative paths because we cd before
archiving. This patch uses an absolute path when creating the archive.
---
 scripts/uscan.pl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index d760281..c1599d3 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -24,6 +24,7 @@
 use 5.008;  # uses 'our' variables and filetest
 use strict;
 use Cwd;
+use Cwd 'abs_path';
 use File::Basename;
 use File::Copy;
 use File::Temp qw/tempdir/;
@@ -1374,12 +1375,13 @@ EOF
 	my $tempdir = tempdir ( "uscanXXXX", TMPDIR => 1, CLEANUP => 1 );
 	my $globpattern = "*";
 	my $hidden = ".[!.]*";
+	my $absdestdir = abs_path($destdir);
 	system("unzip -q -a -d $tempdir $destdir/$newfile_base") == 0
 	  or die("Repacking from zip to tar.gz failed (could not unzip)\n");
 	if (defined glob("$tempdir/$hidden")) {
 	    $globpattern .= " $hidden";
 	}
-	system("cd $tempdir; GZIP=-9 tar --owner=root --group=root --mode=a+rX -czf $destdir/$newfile_base_gz $globpattern") == 0
+	system("cd $tempdir; GZIP=-9 tar --owner=root --group=root --mode=a+rX -czf $absdestdir/$newfile_base_gz $globpattern") == 0
 	  or die("Repacking from zip to tar.gz failed (could not create tarball)\n");
 	unlink "$destdir/$newfile_base";
 	$newfile_base = $newfile_base_gz;
-- 
1.7.5.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to