$options{IGNORE}->{$file}=1;
}
+# Add an item to the with list.
+sub AddWith { my($option,$value)=@_;
+ push @{$options{WITH}},$value;
+}
+
# This collects non-options values.
sub NonOption {
push @{$options{ARGV}}, @_;
"after=s" => \$options{AFTER},
"before=s" => \$options{BEFORE},
"remaining" => \$options{REMAINING},
+ "with=s" => \&AddWith,
"<>" => \&NonOption,
);
install:
install -d $(DESTDIR)/usr/bin \
$(DESTDIR)/usr/share/debhelper/autoscripts \
- $(DESTDIR)$(PERLLIBDIR)
+ $(DESTDIR)$(PERLLIBDIR)/Sequence
install $(shell find -maxdepth 1 -mindepth 1 -name dh\* |grep -v \.1\$$) $(DESTDIR)/usr/bin
install -m 0644 autoscripts/* $(DESTDIR)/usr/share/debhelper/autoscripts
install -m 0644 Debian/Debhelper/*.pm $(DESTDIR)$(PERLLIBDIR)
+ install -m 0644 Debian/Debhelper/Sequence/*.pm $(DESTDIR)$(PERLLIBDIR)/Sequence
test: version
./run perl -MTest::Harness -e 'runtests grep { ! /CVS/ && ! /\.svn/ } @ARGV' t/*
+debhelper (7.0.8) unstable; urgency=low
+
+ * dh: Add an interface that third-party packages providing debhelper commands
+ can use to insert them into a command sequence.
+ (See dh(1), "SEQUENCE ADDONS".)
+ * dh: --with=foo can be used to include such third-party commands.
+ So, for example, --with=cli could add the dh_cli* commands from
+ cli-common.
+ * Moved python-support special case out of dh and into a python-support
+ sequence addon. --with=python-support is enabled by default to avoid
+ breaking backwards compatability.
+
+ -- Joey Hess <joeyh@debian.org> Sun, 04 May 2008 16:10:54 -0400
+
debhelper (7.0.7) unstable; urgency=low
* dh_installxfonts: Fix precidence problem that exposes a new warning
=head1 SYNOPSIS
-B<dh> sequence [B<--until> I<cmd>] [B<--before> I<cmd>] [B<--after> I<cmd>] [B<--remaining>] [S<I<debhelper options>>]
+B<dh> sequence [B<--until> I<cmd>] [B<--before> I<cmd>] [B<--after> I<cmd>] [B<--remaining>] [B<--with> I<addon>] [S<I<debhelper options>>]
=head1 DESCRIPTION
Run all commands in the sequence that have yet to be run.
+=item B<--with> I<addon>
+
+Add the debhelper commands specified by the given addon to appropriate places
+in the sequence of commands that is run. This option can be repeated more
+than once, and is used when there is a third-party package that provides
+debhelper commands. See "SEQUENCE ADDONS" below for documentation about what
+such packages should do to be supported by --with.
+
=back
All other options passed to dh are passed on to each command it runs. This
ambiguity. If there are multiple substring matches, the last one in the
sequence will be used.
+=head1 SEQUENCE ADDONS
+
+When B<--with> I<addon> is used, dh loads the perl module
+Debian::Debhelper::Sequence::I<addon>. Two functions are provided to let
+the module add its commands to sequences:
+
+=over 4
+
+=item Debian::Debhelper::Dh_Lib::insert_before(existing_command, new_command)
+
+Insert I<new_command> in sequences before I<existing_command>.
+
+=item Debian::Debhelper::Dh_Lib::insert_after(existing_command, new_command)
+
+Insert I<new_command> in sequences after I<existing_command>.
+
=cut
sub command_pos {
dh_gconf
dh_icons
dh_perl
- dh_pysupport
dh_scrollkeeper
dh_usrlocal
}, @b];
$sequences{'binary-arch'} = [@{$sequences{binary}}];
-# Third-party commands can be listed in the sequences, but should be
-# listed here as well. They will not be run if not present.
-my %thirdparty=map { $_ => 1 } qw{
- dh_pycentral
- dh_pysupport
-};
+# --with python-support is enabled by default, at least for now
+push @{$dh{WITH}}, "python-support";
+
+# sequence addon interface
+sub _insert {
+ my $offset=shift;
+ my $existing=shift;
+ my $new=shift;
+ foreach my $sequence (keys %sequences) {
+ my @list=@{$sequences{$sequence}};
+ next unless grep $existing, @list;
+ my @new;
+ foreach my $command (@list) {
+ if ($command eq $existing) {
+ push @new, $new if $offset < 0;
+ push @new, $command;
+ push @new, $new if $offset > 0;
+ }
+ else {
+ push @new, $command;
+ }
+ }
+ $sequences{$sequence}=\@new;
+ }
+}
+sub insert_before {
+ _insert(-1, @_);
+}
+sub insert_after {
+ _insert(1, @_);
+}
+foreach my $addon (@{$dh{WITH}}) {
+ my $mod="Debian::Debhelper::Sequence::$addon";
+ $mod=~s/-/_/g;
+ eval "use $mod";
+ if ($@) {
+ error("--with $addon not supported or failed to load module $mod");
+ }
+}
# Get the sequence of commands to run.
if (! @ARGV) {
my $command=shift;
my @options=@_;
- # If a third party command is not in /usr/bin, don't try to run it.
- if ($thirdparty{$command} && ! -x "/usr/bin/$command") {
- return;
- }
-
# 3 space indent lines the command being run up under the
# sequence name after "dh ".
print " ".escape_shell($command, @options)."\n";