[debhelper-devel] [debhelper] 01/02: Replace some ad-hoc checks with excludefile()

Niels Thykier nthykier at moszumanska.debian.org
Sun Dec 31 18:26:46 UTC 2017


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

nthykier pushed a commit to branch master
in repository debhelper.

commit bda6d60b8304da958d1c9cc182b5a510d24280cc
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Dec 31 17:48:59 2017 +0000

    Replace some ad-hoc checks with excludefile()
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh_compress  | 12 +-----------
 dh_dwz       |  8 +++-----
 dh_shlibdeps |  8 +++-----
 dh_strip     |  8 +++-----
 4 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/dh_compress b/dh_compress
index b4a891b..c175615 100755
--- a/dh_compress
+++ b/dh_compress
@@ -139,17 +139,7 @@ on_pkgs_in_parallel {
 
 		# Exclude files from compression.
 		if (@files && defined($dh{EXCLUDE}) && $dh{EXCLUDE}) {
-			my @new=();
-			foreach (@files) {
-				my $ok=1;
-				foreach my $x (@{$dh{EXCLUDE}}) {
-					if (/\Q$x\E/) {
-						$ok='';
-						last;
-					}
-				}
-				push @new,$_ if $ok;
-			}
+			my @new = grep { not excludefile($_) } @files;
 			@files=@new;
 		}
 
diff --git a/dh_dwz b/dh_dwz
index 39844d4..db2fa64 100755
--- a/dh_dwz
+++ b/dh_dwz
@@ -72,11 +72,9 @@ sub testfile {
 
 	# See if we were asked to exclude this file.
 	# Note that we have to test on the full filename, including directory.
-	foreach my $f (@{$dh{EXCLUDE}}) {
-		if ($fn =~ m/\Q$f\E/) {
-			$File::Find::prune = 1 if -d _;
-			return;
-		}
+	if (excludefile($fn)) {
+		$File::Find::prune = 1 if -d _;
+		return;
 	}
 	return if -d _;
 	# Do not process output files from dwz
diff --git a/dh_shlibdeps b/dh_shlibdeps
index ac06e20..09ce19f 100755
--- a/dh_shlibdeps
+++ b/dh_shlibdeps
@@ -140,11 +140,9 @@ on_pkgs_in_parallel {
 				return if -l $fn; # Ignore symlinks
 				# See if we were asked to exclude this file.
 				# Note that we have to test on the full filename, including directory.
-				foreach my $f (@{$dh{EXCLUDE}}) {
-					if ($fn =~ m/\Q$f\E/) {
-						$File::Find::prune = 1 if -d _;
-						return;
-					}
+				if (excludefile($fn)) {
+					$File::Find::prune = 1 if -d _;
+					return;
 				}
 				if (-d _) {
 					# Prune directories that contain separated debug symbols.
diff --git a/dh_strip b/dh_strip
index 420031b..56ae052 100755
--- a/dh_strip
+++ b/dh_strip
@@ -178,11 +178,9 @@ sub testfile {
 	
 	# See if we were asked to exclude this file.
 	# Note that we have to test on the full filename, including directory.
-	foreach my $f (@{$dh{EXCLUDE}}) {
-		if ($fn =~ m/\Q$f\E/) {
-			$File::Find::prune = 1 if -d _;
-			return;
-		}
+	if (excludefile($fn)) {
+		$File::Find::prune = 1 if -d _;
+		return;
 	}
 	return if -d _;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list