diff options
author | Joey Hess <joey@kitenet.net> | 2010-05-27 21:16:26 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-05-27 21:16:26 -0400 |
commit | d3cb133cd8399efa737f86067c490a3bf520f3e9 (patch) | |
tree | ecdc3281b2aa1ce729c6eaf79cde2ea3e97e2518 /dh | |
parent | 21b40c8fc12ca4fb026e65d853bbd0f9c08c7bd5 (diff) |
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)
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.)
Diffstat (limited to 'dh')
-rwxr-xr-x | dh | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -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; |