summaryrefslogtreecommitdiff
path: root/Debian
diff options
context:
space:
mode:
authorjoey <joey>2000-11-28 05:12:23 +0000
committerjoey <joey>2000-11-28 05:12:23 +0000
commit5c808f0c60445978cb180202a9f760032d24f742 (patch)
treea206c5cb4d265fa5321d84aa30dff7164f116bce /Debian
parentc577623cfbfa6aedbe12da4b96759864ae6f466d (diff)
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
Diffstat (limited to 'Debian')
-rw-r--r--Debian/Debhelper/Dh_Lib.pm23
1 files changed, 16 insertions, 7 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 22e9c38..52adf66 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 (<DH_FARRAY_IN>) {
# 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;