From 5c808f0c60445978cb180202a9f760032d24f742 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 28 Nov 2000 05:12:23 +0000 Subject: r398: * If DH_COMPAT=3 is set, the following happens: - Various debian/foo files like debian/docs, debian/examples, etc, begin to support filename globbing. use \* to escape the wildcards of course. I doubt this will bite anyone (Debian doesn't seem to contain files with "*" or "?" in their names..), but it is guarded by v3 just to be sure. Closes: #34120, #37694, #39846, #46249 --- Debian/Debhelper/Dh_Lib.pm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Debian/Debhelper') diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index 22e9c388..52adf66a 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -90,7 +90,7 @@ sub init { sub escape_shell { my $line=shift; # This list is from _Unix in a Nutshell_. (except '#') - $line~s/([\s!"\$()*+#;<>?@\[\]\\`|~])/\\$1/g; + $line=~s/([\s!"\$()*+#;<>?@\[\]\\`|~])/\\$1/g; return $line; } @@ -339,18 +339,27 @@ sub autoscript { } # Reads in the specified file, one word at a time, and returns an array of -# the result. Pass in a true value for the second parameter if the contents -# of the file are filenames that can be glob expanded. +# the result. If a value is passed in as the second parameter, then glob +# expansion is done in the directory specified by the parameter ("." is +# frequently a good choice). sub filearray { my $file=shift; - my $doglob=shift || ''; + my $globdir=shift; my @ret; - open (DH_FARRAY_IN,"<$file") || error("cannot read $file: $1"); + open (DH_FARRAY_IN, $file) || error("cannot read $file: $1"); while () { # Only do glob expansion in v3 mode. - if ($doglob && compat(3)) { - push @ret, map glob, split; + # + # 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 && compat(3)) { + for (map { glob "$globdir/$_" } split) { + s#^$globdir/##; + push @ret, $_; + print "(--$_)\n"; + } } else { push @ret, split; -- cgit v1.2.3