From 62935f37b81b97baa72efd77a9e913756a60ac2c Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Sat, 13 Jun 2009 17:25:31 +0300 Subject: [PATCH] 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. --- Debian/Debhelper/Dh_Buildsystems.pm | 17 ++++++++------ Debian/Debhelper/Dh_Getopt.pm | 35 +++++------------------------ Debian/Debhelper/Dh_Lib.pm | 4 ++-- debhelper.pod | 10 ++------- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index 8e9920f..ac09dd2 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -108,27 +108,30 @@ sub load_all_buildsystems { sub buildsystems_init { my %args=@_; + # TODO: Not documented in the manual pages yet. + # Initialize options from environment variables + if (exists $ENV{DH_AUTO_BUILDDIRECTORY}) { + $opt_builddir = $ENV{DH_AUTO_BUILDDIRECTORY}; + } + if (exists $ENV{DH_AUTO_BUILDSYSTEM}) { + $opt_buildsys = $ENV{DH_AUTO_BUILDSYSTEM}; + } + # Available command line options my %options = ( - "d" => undef, # cancel default D_FLAG option spec "d=s" => \$opt_sourcedir, "sourcedirectory=s" => \$opt_sourcedir, "b:s" => \$opt_builddir, "builddirectory:s" => \$opt_builddir, - "c=s" => \$opt_buildsys, + "m=s" => \$opt_buildsys, "buildsystem=s" => \$opt_buildsys, "l" => \$opt_list, "--list" => \$opt_list, ); $args{options}{$_} = $options{$_} foreach keys(%options); - - # Pass options from the DH_AUTO_OPTIONS environment variable - if (defined $ENV{DH_AUTO_OPTIONS}) { - $args{extra_args} = $ENV{DH_AUTO_OPTIONS}; - } Debian::Debhelper::Dh_Lib::init(%args); } diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm index 2a5aa6c..9ca9d16 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(/(?