diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-06-13 17:25:31 +0300 |
---|---|---|
committer | Modestas Vainius <modestas@vainius.eu> | 2009-06-13 17:30:57 +0300 |
commit | 62935f37b81b97baa72efd77a9e913756a60ac2c (patch) | |
tree | 99fc241bb40736571cd0bac79619a185e567da23 /Debian/Debhelper/Dh_Getopt.pm | |
parent | 9be81947e83e65726f2f34311276a153b5178a18 (diff) |
Revert "Improvements in DH_OPTIONS handling and DH_AUTO_OPTIONS envvar support."
This mostly reverts commit f897611a77726655aea258af0c4d52a8ce759ebc.
Remaining cosmetic changes (all functional changes have been reverted):
* Refactoring of option string into split_options_string() sub (no semantic
changes though).
* Cosmetic change in Dh_Buildsystems.pm.
Breaks testsuite.
Diffstat (limited to 'Debian/Debhelper/Dh_Getopt.pm')
-rw-r--r-- | Debian/Debhelper/Dh_Getopt.pm | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm index 2a5aa6c2..9ca9d167 100644 --- a/Debian/Debhelper/Dh_Getopt.pm +++ b/Debian/Debhelper/Dh_Getopt.pm @@ -71,9 +71,9 @@ sub NonOption { sub getoptions { my $array=shift; - my $extraoptions=shift; + my %options=%{shift()} if ref $_[0]; - my %options=( + Getopt::Long::GetOptionsFromArray($array, "v" => \$dh{VERBOSE}, "verbose" => \$dh{VERBOSE}, @@ -137,35 +137,21 @@ sub getoptions { "ignore=s" => \&AddIgnore, - "<>" => \&NonOption, - ); - - # Merge extra options and cancel default ones as needed (undef) - if (defined $extraoptions) { - for my $opt (keys %$extraoptions) { - if (defined $extraoptions->{$opt}) { - $options{$opt}=$extraoptions->{$opt}; - } - else { - delete $options{$opt}; - } - } - } + %options, - Getopt::Long::GetOptionsFromArray($array, %options); + "<>" => \&NonOption, + ) } sub split_options_string { my $str=shift; - $str=~s/^\s+//; - return map { $_=~s/\\(\s)/$1/g; $_=~s/\s+$//g; $_ } split(/(?<!\\)\s+/,$str); + return split(/\s+/,$str); } # Parse options and set %dh values. sub parseopts { my $options=shift; - my $extra_args=shift; my @ARGV_extra; @@ -208,15 +194,6 @@ sub parseopts { } } - if (defined $extra_args) { - my @extra_opts=split_options_string($extra_args); - my $ret=getoptions(\@extra_opts, $options); - if (!$ret) { - warning("warning: ignored unknown options"); - } - push @ARGV_extra, @extra_opts; - } - my $ret=getoptions(\@ARGV, $options); if (!$ret) { warning("warning: unknown options will be a fatal error in a future debhelper release"); |