[devscripts] 07/09: uscan: Fix handling of 'dirname' exclusions, so 'dirname/*' isn't required.

James McCoy jamessan at debian.org
Mon Dec 23 20:46:20 UTC 2013


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

jamessan pushed a commit to branch master
in repository devscripts.

commit e83f4ca1b94867c17f3c6d83f6f98d2508cbc5e9
Author: James McCoy <jamessan at debian.org>
Date:   Sat Dec 21 21:53:46 2013 -0500

    uscan: Fix handling of 'dirname' exclusions, so 'dirname/*' isn't required.
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog | 1 +
 scripts/uscan.pl | 8 +++-----
 test/test_uscan  | 5 +++++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b08d913..f7ec4cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,7 @@ devscripts (2.13.9) UNRELEASED; urgency=low
       - Use --keep-old-files --no-overwrite-dir
       - Ensure parent directory of directory used for repacking archive isn't
         accessible to other users.
+    + Fix handling of 'dirname' exclusions, so 'dirname/*' isn't required.
 
  -- Martin Pitt <mpitt at debian.org>  Thu, 12 Dec 2013 11:08:27 +0100
 
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index de6cfc1..7da9c11 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1539,14 +1539,12 @@ EOF
 	    my $file_list;
 	    spawn(exec => ['find', $main_source_dir], wait_child => 1, to_string => \$file_list);
 	    my $nfiles_before = split /\n/, $file_list;
-	    foreach (grep {/\//} split /\s+/, $data->{"files-excluded"}) {
+	    foreach (grep { $_ } split /\s+/, $data->{"files-excluded"}) {
 		# delete trailing '/' because otherwise find -path will fail
 		s?/+$??;
 		# use rm -rf to enable deleting non-empty directories
-		system('find', $main_source_dir, '-path', "$main_source_dir/$_", '-exec', 'rm', '-rf', '{}', '+');
-	    }
-	    foreach (grep {/^[^\/]+$/} split /\s+/, $data->{"files-excluded"}) {
-		system('find', $main_source_dir, '-type', 'f', '-name', $_, '-delete');
+		spawn(exec => ['find', $main_source_dir, '-path', "$main_source_dir/$_", '-exec', 'rm', '-rf', '{}', '+'],
+		      wait_child => 1);
 	    }
 	    undef $file_list;
 	    spawn(exec => ['find', $main_source_dir], wait_child => 1, to_string => \$file_list);
diff --git a/test/test_uscan b/test/test_uscan
index 30f98b0..2f27bef 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -67,12 +67,15 @@ END
     cat <<END > $TMPDIR/$PKG/debian/copyright
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Files-Excluded: exclude-this
+ exclude-dir
 END
 
     mkdir -p $TMPDIR/repo
     touch $TMPDIR/repo/include-this
     touch $TMPDIR/repo/exclude-this
     mkdir -p "$TMPDIR/repo/; echo baz; #/"
+    mkdir -p $TMPDIR/repo/exclude-dir
+    touch $TMPDIR/repo/exclude-dir/file
 
     ( cd $TMPDIR/repo ;
       tar cfz $PKG-1.tar.gz * ;
@@ -85,6 +88,8 @@ END
     assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
     assertNull 'file that must be excluded is present in the tarball'	\
                "$( tar tzf $TMPDIR/$TARBALL  | grep exclude-this )"
+    assertNull "dir that must be excluded is present in the tarball"	\
+               "$(tar atf $TMPDIR/$TARBALL | grep exclude-dir)"
     # 731849
     assertNull 'dirty root directory allowed command execution' "$OUTPUT"
 

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