On Tue, Sep 04, 2012 at 07:14:21PM +0200, Andreas Tille wrote:

> You might like to check my last commit to
>     git://git.debian.org/git/users/tille/devscripts.git

(currently 4b3a4a6310ff1ff80ac1498cf92a99817c75ffce)

> and check whether it matches your expectations when injecting
> Files-Excluded field into debian/copyright.

At first view, your changes correct
- "foo" should match "foo", even if a directory.
but do not correct
- "foo" should not match "bar/foo", even if a file.
- "foo/" should never match, even if "foo" is a directory.

DEP5 does not distinguish files from directories, or whether paths
contain a slash. Why should you do these tests in your code? I suggest
the following patch.

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 649f822..34e31a9 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1494,17 +1494,9 @@ EOF
                 print STDERR "Error: $main_source_dir is no directory";
             }
             my $nfiles_before = `find $main_source_dir | wc -l`;
-            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
+            foreach (split /\s+/, $data->{"files-excluded"}) {
                 `find "$main_source_dir" -path "$main_source_dir/$_" -print0 | 
xargs -0 rm -rf`;
             };
-            foreach (grep {/^[^\/]+$/} split /\s+/, $data->{"files-excluded"}) 
{
-                `find "$main_source_dir" -type f -name "$_" -delete`;
-                # the statement above does not delete directories - just do it 
now
-                `rm -rf "$main_source_dir/$_" ` if ( -d "$main_source_dir/$_" 
) ;
-            };
             my $nfiles_after = `find $main_source_dir | wc -l`;
             if ( $nfiles_before == $nfiles_after && ! $exclude__MACOSX ) {
                 print "-- Source tree remains identical - no need for 
repacking.\n" if $verbose;


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120904231747.GA3868@pegase

Reply via email to