summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Dh_Lib.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-12-07 14:08:41 -0400
committerJoey Hess <joey@kitenet.net>2011-12-07 15:07:49 -0400
commit83a233af6f938bcd50745b35fabb15788293452e (patch)
tree16185edf2db8c992cb3e31d39c9b6956a6e3142e /Debian/Debhelper/Dh_Lib.pm
parent46ecfad5fed9e0e4ef179f5ec531f996400669b7 (diff)
executable config files. bleh, argh
Debhelper config files may be made executable programs that output the desired configuration. No further changes are planned to the config file format; those needing powerful syntaxes may now use a programming language of their choice. In many bugs I see a tendency of users wanting debhelper configuration files to have their pet feature from some programming language. So I choose to short-circuit this process by taking it to its logical conclusion, and without the bother of developing a new language myself. [ Is this consistent with my boycott/disinterest in integrating features features first developed in Ubuntu? Yes. Instead of blocking the issue of multiarch needing variable expansions, I have stepped back and let anyone make whatever mess they desire while not forcing that mess on the rest of us. ]
Diffstat (limited to 'Debian/Debhelper/Dh_Lib.pm')
-rw-r--r--Debian/Debhelper/Dh_Lib.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 60f13c3..a86688a 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -613,12 +613,21 @@ sub filedoublearray {
my $file=shift;
my $globdir=shift;
+ my $x=-x $file;
+ if ($x) {
+ require Cwd;
+ my $cmd=Cwd::abs_path($file);
+ open (DH_FARRAY_IN, "$cmd |") || error("cannot run $file: $!");
+ }
+ else {
+ open (DH_FARRAY_IN, $file) || error("cannot read $file: $!");
+ }
+
my @ret;
- open (DH_FARRAY_IN, $file) || error("cannot read $file: $!");
while (<DH_FARRAY_IN>) {
chomp;
# Only ignore comments and empty lines in v5 mode.
- if (! compat(4)) {
+ if (! compat(4) && ! $x) {
next if /^#/ || /^$/;
}
my @line;
@@ -627,7 +636,7 @@ sub filedoublearray {
# 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(2)) {
+ if (defined $globdir && ! compat(2) && ! $x) {
foreach (map { glob "$globdir/$_" } split) {
s#^$globdir/##;
push @line, $_;
@@ -638,7 +647,8 @@ sub filedoublearray {
}
push @ret, [@line];
}
- close DH_FARRAY_IN;
+
+ close DH_FARRAY_IN || error("problem reading $file: $!");
return @ret;
}