[devscripts] 01/01: Excluded-Files: Anchor matches anywhere in the filename
Joachim Breitner
nomeata at moszumanska.debian.org
Fri Mar 21 12:56:42 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 450e55d3b7b04822a2e2b05c1440f1db68a1940b
Author: Joachim Breitner <nomeata at debian.org>
Date: Fri Mar 21 13:56:06 2014 +0100
Excluded-Files: Anchor matches anywhere in the filename
i.e. let js/jquery.js also remove pkg-1.0/docs/html/js/jquery.js.
With extended testcase.
---
scripts/uscan.pl | 11 ++++++++---
test/test_uscan | 11 +++++++----
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index bd7b998..5254b70 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1567,14 +1567,19 @@ EOF
}
# find out what to delete
+ $Text::Glob::strict_leading_dot = 0;
+ $Text::Glob::strict_wildcard_slash = 0;
my @to_delete;
for my $filename (@files) {
my $do_exclude = 0;
for my $exclude (@excluded) {
$do_exclude ||=
- Text::Glob::match_glob($exclude, $filename) ||
- Text::Glob::match_glob($exclude."/", $filename) ||
- Text::Glob::match_glob($exclude."/*", $filename);
+ Text::Glob::match_glob("$exclude", $filename) ||
+ Text::Glob::match_glob("$exclude/", $filename) ||
+ Text::Glob::match_glob("$exclude/*", $filename) ||
+ Text::Glob::match_glob("*/$exclude", $filename) ||
+ Text::Glob::match_glob("*/$exclude/", $filename) ||
+ Text::Glob::match_glob("*/$exclude/*", $filename);
}
push @to_delete, $filename if $do_exclude;
}
diff --git a/test/test_uscan b/test/test_uscan
index e5ac8bf..c40c9bf 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -173,6 +173,7 @@ END
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files-Excluded: exclude-this
exclude-dir
+ js/jquery.js
END
# Test matching with escaped characters
@@ -187,6 +188,8 @@ END
touch $TMPDIR/repo/exclude-dir/file
mkdir -p $TMPDIR/repo/exclude-dir/subdir
touch $TMPDIR/repo/exclude-dir/subdir/file2
+ mkdir -p $TMPDIR/repo/docs/html/js/
+ touch $TMPDIR/repo/docs/html/js/jquery.js
( cd $TMPDIR/repo ;
tar cfz $PKG-1.tar.gz * ;
@@ -208,6 +211,8 @@ END
$(containsName "$CONTENTS" exclude-dir)
assertFalse "subdir that must be excluded is present in the tarball" \
$(containsName "$CONTENTS" subdir)
+ assertFalse "non-root-file that must be excluded is present in the tarball" \
+ $(containsName "$CONTENTS" jquery.js)
assertFalse "path with whitespace that must be excluded is present" \
$(containsName "$CONTENTS" "; echo baz; #/")
@@ -252,11 +257,9 @@ END
touch $TMPDIR/repo/include-this
touch $TMPDIR/repo/exclude-this
mkdir -p "$TMPDIR/repo/; echo baz; #/"
- mkdir -p $TMPDIR/repo/exclude-dir
+ mkdir -p $TMPDIR/repo/exclude-dir/subdir
touch $TMPDIR/repo/exclude-dir/file
- # doesn't work yet
- # mkdir -p $TMPDIR/repo/exclude-dir/subdir
- # touch $TMPDIR/repo/exclude-dir/subdir/file2
+ touch $TMPDIR/repo/exclude-dir/subdir/file2
( cd $TMPDIR/repo ;
zip -r $PKG-1.zip * ;
--
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