From f11bc43f37229de1495579df8fa9745f87f28080 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Feb 2008 22:40:09 -0500 Subject: [PATCH] * If a tarball contains files all in one subdirectory, and the source tree it's being generates from already has that subdirectory, don't try to create the subdir, which would fail. OTOH, if the subdirectory isn't there, proceed with creating it as before. --- debian/changelog | 9 +++++++++ pristine-tar | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5b65943..7227266 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +pristine-tar (0.8) UNRELEASED; urgency=low + + * If a tarball contains files all in one subdirectory, and the source + tree it's being generates from already has that subdirectory, don't + try to create the subdir, which would fail. OTOH, if the subdirectory + isn't there, proceed with creating it as before. + + -- Joey Hess Fri, 01 Feb 2008 22:36:54 -0500 + pristine-tar (0.7) unstable; urgency=low * Improve/fix handling when there is no local pristine-tar branch. diff --git a/pristine-tar b/pristine-tar index 16387fb..14f2de1 100755 --- a/pristine-tar +++ b/pristine-tar @@ -205,15 +205,27 @@ sub recreatetarball { last; } } + + if (length $subdir && -d "$source/$subdir") { + my $all_in_subdir=1; + foreach my $file (@manifest) { + if (! -e "$source/$file" && + ! -l "$source/$file") { + $all_in_subdir=0; + last; + } + } + if ($all_in_subdir) { + debug("source already in subdir $subdir"); + $subdir=""; + } + } if (length $subdir) { debug("subdir is $subdir"); doit("mkdir", "$tempdir/workdir"); $subdir="/$subdir"; } - else { - debug("tarball does not unpack into a subdir"); - } if (! $options{clobber_source}) { doit("cp", "-a", $source, "$tempdir/workdir$subdir"); -- 2.7.4