[debhelper-devel] [debhelper] 02/15: Dh_Lib: Make file(double)array support using glob_expand

Niels Thykier nthykier at moszumanska.debian.org
Wed Jun 28 13:47:47 UTC 2017


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

nthykier pushed a commit to branch glob-refactor
in repository debhelper.

commit 261eafef0224d8eb9a3b5b621574cc1712ecf26c
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jun 27 16:26:55 2017 +0000

    Dh_Lib: Make file(double)array support using glob_expand
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index ba5dd33..b659e42 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -985,8 +985,7 @@ sub glob_expand {
 # expansion is done in the directory specified by the parameter ("." is
 # frequently a good choice).
 sub filedoublearray {
-	my $file=shift;
-	my $globdir=shift;
+	my ($file, $globdir, $error_handler) = @_;
 
 	# executable config files are a v9 thing.
 	my $x=! compat(8) && -x $file;
@@ -1008,13 +1007,21 @@ sub filedoublearray {
 			next if /^#/ || /^$/;
 		}
 		my @line;
-		# The tricky bit is that the glob expansion is done
-		# as if we were in the specified directory, so the
-		# filenames that come out are relative to it.
+
 		if (defined($globdir) && ! $x) {
-			foreach (map { glob "$globdir/$_" } split) {
-				s#^$globdir/##;
-				push @line, $_;
+			if (ref($globdir)) {
+				my @patterns = split;
+				push(@line, glob_expand($globdir, $error_handler, @patterns));
+			} else {
+				# Legacy call - Silently discards globs that match nothing.
+				#
+				# The tricky bit is that the glob expansion is done
+				# as if we were in the specified directory, so the
+				# filenames that come out are relative to it.
+				foreach (map { glob "$globdir/$_" } split) {
+					s#^$globdir/##;
+					push @line, $_;
+				}
 			}
 		}
 		else {

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