summaryrefslogtreecommitdiff
path: root/Debian
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-01-04 16:06:08 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-01-04 16:06:08 -0500
commit09d21e9f004aabe6a409c981c8d11e7cb4c2051f (patch)
tree1a5a1095251b09f87028f5be68e6eee3642a4ebd /Debian
parent9afe080c5ee27e6e9170d09c9dc5c72cccbdc27e (diff)
downloaddebhelper-09d21e9f004aabe6a409c981c8d11e7cb4c2051f.tar.gz
Fix warning about unknown options passed to commands in override targets.
dh used DH_OVERRIDE_UNKNOWN_OPTIONS, which was too broad as it affected commands run via override targets and caused there to be no warning about unknown options. Now unknown options are only ignored when parsing DH_INTERNAL_OPTIONS and dh's own options.
Diffstat (limited to 'Debian')
-rw-r--r--Debian/Debhelper/Dh_Getopt.pm19
-rw-r--r--Debian/Debhelper/Dh_Lib.pm2
2 files changed, 10 insertions, 11 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm
index edb3be76..0d021072 100644
--- a/Debian/Debhelper/Dh_Getopt.pm
+++ b/Debian/Debhelper/Dh_Getopt.pm
@@ -68,10 +68,11 @@ sub NonOption {
sub getoptions {
my $array=shift;
- my %options=%{shift()} if ref $_[0];
+ my %params=@_;
+ my %options=%{$params{options}} if ref $params{options};
my $oldwarn;
- if ($ENV{DH_IGNORE_UNKNOWN_OPTIONS}) {
+ if ($params{ignore_unknown_options}) {
$oldwarn=$SIG{__WARN__};
$SIG{__WARN__}=sub {};
}
@@ -141,7 +142,7 @@ sub getoptions {
"<>" => \&NonOption,
);
- if ($ENV{DH_IGNORE_UNKNOWN_OPTIONS}) {
+ if ($params{ignore_unknown_options}) {
$SIG{__WARN__}=$oldwarn;
return 1;
}
@@ -158,7 +159,7 @@ sub split_options_string {
# Parse options and set %dh values.
sub parseopts {
- my $options=shift;
+ my %params=@_;
my @ARGV_extra;
@@ -166,7 +167,7 @@ sub parseopts {
# dh through an override target to a command.
if (defined $ENV{DH_INTERNAL_OPTIONS}) {
@ARGV_extra=split(/\x1e/, $ENV{DH_INTERNAL_OPTIONS});
- getoptions(\@ARGV_extra, $options);
+ getoptions(\@ARGV_extra, %params, ignore_unknown_options => 1);
# Avoid forcing acting on packages specified in
# DH_INTERNAL_OPTIONS. This way, -p can be specified
@@ -185,18 +186,16 @@ sub parseopts {
delete $dh{DOARCH};
}
- # DH_OPTIONS can contain additional options
- # to be parsed like @ARGV, but with unknown options
- # skipped.
+ # DH_OPTIONS can contain additional options to be parsed like @ARGV
if (defined $ENV{DH_OPTIONS}) {
@ARGV_extra=split_options_string($ENV{DH_OPTIONS});
- my $ret=getoptions(\@ARGV_extra, $options);
+ my $ret=getoptions(\@ARGV_extra, %params);
if (!$ret) {
warning("warning: ignored unknown options in DH_OPTIONS");
}
}
- my $ret=getoptions(\@ARGV, $options);
+ my $ret=getoptions(\@ARGV, %params);
if (!$ret) {
warning("warning: unknown options will be a fatal error in a future debhelper release");
#error("unknown option; aborting");
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index a4e35709..f37ff518 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -33,7 +33,7 @@ sub init {
grep /^-/, @ARGV) {
eval "use Debian::Debhelper::Dh_Getopt";
error($@) if $@;
- Debian::Debhelper::Dh_Getopt::parseopts($params{options});
+ Debian::Debhelper::Dh_Getopt::parseopts(%params);
}
# Another way to set excludes.