]> git.donarmstrong.com Git - debhelper.git/commitdiff
Make dh not complain about unknown, command-specific options passed to it
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 29 Jun 2009 20:10:48 +0000 (16:10 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 29 Jun 2009 20:10:48 +0000 (16:10 -0400)
and further suppress warnings about such options it passes on to debhelper
commands. This was attempted incompletely before in version 7.2.17.

Debian/Debhelper/Dh_Getopt.pm
debian/changelog
dh

index 9868124cbf996ed82c88b9c9207af94ecbb803ab..86f3cdba585cf5bb77bc074dfb491fe779513347 100644 (file)
@@ -72,8 +72,14 @@ sub NonOption {
 sub getoptions {
        my $array=shift;
        my %options=%{shift()} if ref $_[0];
+       
+       my $oldwarn;
+       if ($ENV{DH_IGNORE_UNKNOWN_OPTIONS}) {
+               $oldwarn=$SIG{__WARN__};
+               $SIG{__WARN__}=sub {};
+       }
 
-       Getopt::Long::GetOptionsFromArray($array,
+       my $ret=Getopt::Long::GetOptionsFromArray($array,
                "v" => \$dh{VERBOSE},
                "verbose" => \$dh{VERBOSE},
 
@@ -136,7 +142,15 @@ sub getoptions {
                %options,
 
                "<>" => \&NonOption,
-       )
+       );
+
+       if ($ENV{DH_IGNORE_UNKNOWN_OPTIONS}) {
+               $SIG{__WARN__}=$oldwarn;
+               return 1;
+       }
+       else {
+               return $ret;
+       }
 }
 
 sub split_options_string {
@@ -155,11 +169,7 @@ sub parseopts {
        # dh through an override target to a command.
        if (defined $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 {};
                getoptions(\@ARGV_extra, $options);
-               $SIG{__WARN__}=$oldwarn;
 
                # Avoid forcing acting on packages specified in
                # DH_INTERNAL_OPTIONS. This way, -p can be specified
index 66b88abde31d2f34d252dd97d78e9d749ec69cd9..a28a48393475017f532dc0dc25c6b2be15bc7bbb 100644 (file)
@@ -21,8 +21,11 @@ debhelper (7.3.0) UNRELEASED; urgency=low
   * Move two more command-specific options to only be accepted by the commands
     that use them. The options are:
     --sourcedir, --destdir
-  * If any third-party debhelper commands use either of the above options,
+    If any third-party debhelper commands use either of the above options,
     they will be broken, and need to be changed to pass options to init().
+  * Make dh not complain about unknown, command-specific options passed to it,
+    and further suppress warnings about such options it passes on to debhelper
+    commands. This was attempted incompletely before in version 7.2.17.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 20 Apr 2009 16:26:08 -0400
 
diff --git a/dh b/dh
index bcd5b02dae530fbf3055cbacab5b013c84fb0a7d..4ea69b25a6fb025ee990e72db56336c1a5b5752b 100755 (executable)
--- a/dh
+++ b/dh
@@ -197,6 +197,11 @@ my @ARGV_orig=@ARGV;
 # python-support is enabled by default, at least for now
 # (and comes first so python-central loads later and can disable it).
 unshift @ARGV, "--with=python-support";
+               
+# Disable complaints about unknown options for both dh and the commands
+# it runs. This is done because dh accepts and passes on options that may
+# be specific to only some debhelper commands.
+$ENV{DH_IGNORE_UNKNOWN_OPTIONS}=1;
 
 init(options => {
        "until=s" => \$dh{UNTIL},