]> git.donarmstrong.com Git - debhelper.git/commitdiff
In v8 mode, dh expects the sequence to run is always its first parameter.
authorJoey Hess <joey@kitenet.net>
Fri, 28 May 2010 01:16:26 +0000 (21:16 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 28 May 2010 01:16:26 +0000 (21:16 -0400)
This avoids ambiguities when parsing options to be passed on to debhelper
commands. (See #570039)

In the end, the idea of putting the debhelper command options after --
seemed to need too much knowledge about whether an option like
--buildsystem is a dh option or a command option.

I did consider making no change.. The ambiguities this eliminates are
small. But it seemed worth simplifying dh's option parser, and only about
1/6th of calls to dh in the archive don't put the sequence first already.
(Docs have shown that as the right thing to do for some time.)

debhelper.pod
debian/changelog
dh
doc/TODO

index 2f44e4d0908c4b4a400b7e4fc07a42161573b9ab..919151032df994f6952e3fb843a81f754b4542fc 100644 (file)
@@ -526,6 +526,11 @@ Also, libraries in unusual locations that dpkg-gensymbols would not
 have processed before will be passed to it, a behavior change that 
 can cause some packages to fail to build.
 
+=item -
+
+dh requires the sequence to run be specified as the first parameter, and
+any switches come after it.
+
 =back
 
 =back
index 6e2aced954733ea1860e1c058fafbaca130e9fba..4cbb1df16b85cf1bfa05014d6fb7e4ed4ee668bc 100644 (file)
@@ -1,4 +1,4 @@
-debhelper (7.4.21) UNRELEASED; urgency=low
+debhelper (7.9.1) UNRELEASED; urgency=low
 
   * dh_installman: Support .so links relative to the current section.
   * dh_installman: Avoid converting .so links to symlinks if the link
@@ -18,6 +18,9 @@ debhelper (7.4.21) UNRELEASED; urgency=low
     (genesis) still uses them.
   * dh_fixperms: Tighten globs used to find library .so files,
     avoiding incorrectly matching things like "foo.sources". Closes: #583328
+  * In v8 mode, dh expects the sequence to run is always its first parameter.
+    This avoids ambiguities when parsing options to be passed on to debhelper
+    commands. (See #570039)
 
  -- Joey Hess <joeyh@debian.org>  Mon, 17 May 2010 20:01:19 -0400
 
diff --git a/dh b/dh
index a19a94a33eb276cd47e5056fa8e7bfedd26f2f25..8327b64a31acd40be9bf5173058bf8589241f9b5 100755 (executable)
--- a/dh
+++ b/dh
@@ -468,17 +468,31 @@ foreach my $addon (@{$dh{WITH}}) {
        }
 }
 
-# Get the sequence of commands to run.
-if (! @ARGV) {
+my $sequence;
+if (! compat(7)) {
+       # From v8, the sequence is the very first parameter.
+       $sequence=shift @ARGV_orig;
+       if ($sequence=~/^-/) {
+               error "Unknown sequence $sequence (options should not come before the sequence)";
+       }
+}
+else {
+       # Before v8, the sequence could be at any position in the parameters,
+       # so was what was left after parsing.
+       $sequence=shift;
+       if (defined $sequence) {
+               @ARGV_orig=grep { $_ ne $sequence } @ARGV_orig;
+       }
+}
+if (! defined $sequence) {
        error "specify a sequence to run";
 }
-my $sequence=shift;
 if ($sequence eq 'debian/rules' ||
     $sequence =~ /^override_dh_/) {
-       # make -B causes the rules file to be run as a target
-       # and support completly empty override targets
-       exit 0
-}      
+       # make -B causes the rules file to be run as a target.
+       # Also support completly empty override targets.
+       exit 0;
+}
 elsif (! exists $sequences{$sequence}) {
        error "Unknown sequence $sequence (choose from: ".
                join(" ", sort keys %sequences).")";
@@ -506,7 +520,6 @@ elsif ($sequence eq 'binary-indep') {
 }
 while (@ARGV_orig) {
        my $opt=shift @ARGV_orig;
-       next if $opt eq $sequence;
        if ($opt =~ /^--?(after|until|before|with|without)$/) {
                shift @ARGV_orig;
                next;
index 44547538fa1de6ae4c5b43f10be31c0a96b34a82..1f500806ac829f2bc49362503d5c7db540364778 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,15 +1,11 @@
 v8:
 
-* clean up dh's handling of options passed onto commands it calls,
-  by implementing one of the changes discussed in #570039
-  (either change #3, change #4, or change #5; change #0 was done, but 
-  was an incomplete workaround)
-  My preference ATM is #3, require dh options come before --,
-  and after, options to be passed on to commands.
 * better package arch filtering for -N , -p (#576990)
 * Support DEB_BUILD_OPTIONS=debug ; maybe also support passing
   -g -O2 by default. See patch (and discussion of why this breaks
   compatability) in #544844.
+* Reorder build systems list. perl_build before perl_makemaker.
+  Any other changes? #578805
 
 v9: