[devscripts] 01/04: mk-origtargz: Match directories more reliably

Joachim Breitner nomeata at moszumanska.debian.org
Thu Apr 17 15:48:02 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 83d80af3e245c40accfea41e8d114b19d076cea2
Author: Joachim Breitner <nomeata at debian.org>
Date:   Thu Apr 17 17:41:51 2014 +0200

    mk-origtargz: Match directories more reliably
    
    tar will print them with / at the end, the patterns will not have a
    trailing slash, so add one when matching.
---
 scripts/mk-origtargz.pl |  4 +++-
 test/test_mk-origtargz  | 12 ++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/scripts/mk-origtargz.pl b/scripts/mk-origtargz.pl
index 53517f4..9d3745e 100755
--- a/scripts/mk-origtargz.pl
+++ b/scripts/mk-origtargz.pl
@@ -409,7 +409,9 @@ if (scalar @exclude_globs > 0) {
 		for my $exclude (@exclude_globs) {
 			$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);
 		}
 		push @to_delete, $filename if $do_exclude;
 	}
diff --git a/test/test_mk-origtargz b/test/test_mk-origtargz
index b3b044b..51f8e67 100755
--- a/test/test_mk-origtargz
+++ b/test/test_mk-origtargz
@@ -58,6 +58,8 @@ makeUpstreamFiles () {
 
 	makeSubDir "include-this-dir"
 	makeSubDir "exclude-this-dir"
+	makeSubDir "exclude-dir1"
+	makeSubDir "exclude-dir2"
 	makeSubDir ".include-this-hidden-dir"
 	makeSubDir ".exclude-this-hidden-dir"
 	makeSubDir "a-dir/include-this-subdir"
@@ -95,6 +97,8 @@ makeDebianCopyright() {
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Files-Excluded: exclude-this*
  .exclude-this*
+ exclude-dir1
+ exclude-dir2/
  ;\ echo\ strange-file;\ #
 END
 
@@ -286,7 +290,7 @@ testExclude() {
 	makeDebanDir
 	makeDebianCopyright
 	run_mk_origtargz foo \
-		"Successfully repacked ../foo-0.1.tar.gz as ../foo_0.1.orig.tar.gz, deleting 15 files from it." \
+		"Successfully repacked ../foo-0.1.tar.gz as ../foo_0.1.orig.tar.gz, deleting 17 files from it." \
 		 ../foo-0.1.tar.gz
 	assertTrue "result does not exist" "[ -e $TMPDIR/foo_0.1.orig.tar.gz ]"
 	assertType application/gzip $TMPDIR/foo_0.1.orig.tar.gz
@@ -298,7 +302,7 @@ testExcludeXZ() {
 	makeDebanDir
 	makeDebianCopyright
 	run_mk_origtargz foo \
-		"Successfully repacked ../foo-0.1.tar.xz as ../foo_0.1.orig.tar.xz, deleting 15 files from it." \
+		"Successfully repacked ../foo-0.1.tar.xz as ../foo_0.1.orig.tar.xz, deleting 17 files from it." \
 		 ../foo-0.1.tar.xz
 	assertTrue "result does not exist" "[ -e $TMPDIR/foo_0.1.orig.tar.xz ]"
 	assertType application/x-xz $TMPDIR/foo_0.1.orig.tar.xz
@@ -310,7 +314,7 @@ testExcludeZip() {
 	makeDebanDir
 	makeDebianCopyright
 	run_mk_origtargz foo \
-		"Successfully repacked ../foo-0.1.zip as ../foo_0.1.orig.tar.xz, deleting 15 files from it." \
+		"Successfully repacked ../foo-0.1.zip as ../foo_0.1.orig.tar.xz, deleting 17 files from it." \
 		 ../foo-0.1.zip --compression xz
 	assertTrue "result does not exist" "[ -e $TMPDIR/foo_0.1.orig.tar.xz ]"
 	assertType application/x-xz $TMPDIR/foo_0.1.orig.tar.xz
@@ -356,7 +360,7 @@ testSameNameExclude() {
 	makeDebanDir
 	makeDebianCopyright
 	run_mk_origtargz foo \
-		"Leaving ../foo_0.1.orig.tar.gz where it is, deleting 15 files from it." \
+		"Leaving ../foo_0.1.orig.tar.gz where it is, deleting 17 files from it." \
 		 ../foo_0.1.orig.tar.gz
 	assertTrue "result does not exist" "[ -e $TMPDIR/foo_0.1.orig.tar.gz ]"
 	assertFalse "result is a symlink" "[ -L $TMPDIR/foo_0.1.orig.tar.gz ]"

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