From: Joey Hess Date: Fri, 27 Feb 2009 20:22:34 +0000 (-0500) Subject: fix option parsing sideport X-Git-Tag: 7.2.0~1^2~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9c7cc9907c64f9975d49fc3504b0abbd747f18cc;p=debhelper.git fix option parsing sideport --- diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm index d801933..3221a96 100644 --- a/Debian/Debhelper/Dh_Getopt.pm +++ b/Debian/Debhelper/Dh_Getopt.pm @@ -81,6 +81,14 @@ sub NonOption { # Parse options and return a hash of the values. sub parseopts { undef %options; + + # DH_INTERNAL_OPTIONS is used to pass additional options from + # dh through an override target to a command. + if (defined $ENV{DH_INTERNAL_OPTIONS}) { + $ENV{DH_INTERNAL_OPTIONS}=~s/^\s+//; + $ENV{DH_INTERNAL_OPTIONS}=~s/\s+$//; + unshift @ARGV, split(/\s+/,$ENV{DH_INTERNAL_OPTIONS}); + } my $ret=GetOptions( "v" => \$options{VERBOSE}, @@ -190,20 +198,11 @@ sub parseopts { "<>" => \&NonOption, ); - - # DH_INTERNAL_OPTIONS is used to pass additional options from - # dh through an override target to a command. - if (defined $ENV{DH_INTERNAL_OPTIONS}) { - $ENV{DH_INTERNAL_OPTIONS}=~s/^\s+//; - $ENV{DH_INTERNAL_OPTIONS}=~s/\s+$//; - unshift @ARGV, split(/\s+/,$ENV{DH_INTERNAL_OPTIONS}); - } - - my $ret=getoptions(\@ARGV, $options); + if (!$ret) { error("unknown option; aborting"); } - + # Check to see if -V was specified. If so, but no parameters were # passed, the variable will be defined but empty. if (defined($options{V_FLAG})) {