summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Dh_Getopt.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Debian/Debhelper/Dh_Getopt.pm')
-rw-r--r--Debian/Debhelper/Dh_Getopt.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm
index 864b168..9ca9d16 100644
--- a/Debian/Debhelper/Dh_Getopt.pm
+++ b/Debian/Debhelper/Dh_Getopt.pm
@@ -143,6 +143,12 @@ sub getoptions {
)
}
+sub split_options_string {
+ my $str=shift;
+ $str=~s/^\s+//;
+ return split(/\s+/,$str);
+}
+
# Parse options and set %dh values.
sub parseopts {
my $options=shift;
@@ -152,10 +158,7 @@ sub parseopts {
# 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+$//;
- @ARGV_extra=split(/\s+/,$ENV{DH_INTERNAL_OPTIONS});
-
+ @ARGV_extra=split_options_string($ENV{DH_INTERNAL_OPTIONS});
# Unknown options will be silently ignored.
my $oldwarn=$SIG{__WARN__};
$SIG{__WARN__}=sub {};
@@ -184,9 +187,7 @@ sub parseopts {
# to be parsed like @ARGV, but with unknown options
# skipped.
if (defined $ENV{DH_OPTIONS}) {
- $ENV{DH_OPTIONS}=~s/^\s+//;
- $ENV{DH_OPTIONS}=~s/\s+$//;
- @ARGV_extra=split(/\s+/,$ENV{DH_OPTIONS});
+ @ARGV_extra=split_options_string($ENV{DH_OPTIONS});
my $ret=getoptions(\@ARGV_extra, $options);
if (!$ret) {
warning("warning: ignored unknown options in DH_OPTIONS");