]> git.donarmstrong.com Git - debhelper.git/commitdiff
Revert "Improvements in DH_OPTIONS handling and DH_AUTO_OPTIONS envvar support."
authorModestas Vainius <modestas@vainius.eu>
Sat, 13 Jun 2009 14:25:31 +0000 (17:25 +0300)
committerModestas Vainius <modestas@vainius.eu>
Sat, 13 Jun 2009 14:30:57 +0000 (17:30 +0300)
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
Debian/Debhelper/Dh_Getopt.pm
Debian/Debhelper/Dh_Lib.pm
debhelper.pod

index 8e9920f1f21b533e66c310e0f2ec14ce016dde2e..ac09dd289d50f6c7f79fcecc782a014197b5b3d6 100644 (file)
@@ -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);
 }
 
index 2a5aa6c26fa308861979070fef2ccdd77acee668..9ca9d167ba4a0218a1b16eea50e35a3f996d9d90 100644 (file)
@@ -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");
index b3162d07ae9a77cc2844d73291e4b09436acbfe1..28a90f7bdad16b37900c7021d9b055f2d8f6388b 100644 (file)
@@ -29,10 +29,10 @@ sub init {
        # Getopt::Long, which I'd prefer to avoid loading at all if possible.
        if ((defined $ENV{DH_OPTIONS} && length $ENV{DH_OPTIONS}) ||
            (defined $ENV{DH_INTERNAL_OPTIONS} && length $ENV{DH_INTERNAL_OPTIONS}) ||
-           (defined $params{extra_args}) || grep /^-/, @ARGV) {
+           grep /^-/, @ARGV) {
                eval "use Debian::Debhelper::Dh_Getopt";
                error($@) if $@;
-               Debian::Debhelper::Dh_Getopt::parseopts($params{options}, $params{extra_args});
+               Debian::Debhelper::Dh_Getopt::parseopts($params{options});
        }
 
        # Another way to set excludes.
index 8c232d2859bac1e3caac44cfed1beefb7a63cf21..388453c3005c2442b3c026cc9eea3ecf324cdc6a 100644 (file)
@@ -491,14 +491,8 @@ Anything in this variable will be prepended to the command line arguments
 of all debhelper commands. Command-specific options will be ignored by 
 commands that do not support them. 
 
-Arguments are separated by whitespaces unless a whitespace is escaped
-with a backslash character (\). Then the whitespace is treated literally.
-Likewise, the backslash character is treated literally unless it is followed
-by a single whitespace. If a backslash is followed by two or more spaces,
-it will be considered as the last symbol of the argument.
-
-DH_OPTIONS is useful in some situations, for example, if you need to pass -p
-to all debhelper commands that will be run. One good way to set DH_OPTIONS is
+This is useful in some situations, for example, if you need to pass -p to
+all debhelper commands that will be run. One good way to set DH_OPTIONS is
 by using "Target-specific Variable Values" in your debian/rules file. See
 the make documentation for details on doing this.