summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Debian/Debhelper/Dh_Getopt.pm6
-rw-r--r--Debian/Debhelper/Sequence/python_support.pm15
-rw-r--r--Makefile3
-rw-r--r--debian/changelog14
-rwxr-xr-xdh77
5 files changed, 101 insertions, 14 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm
index 55e37fd2..77e4a723 100644
--- a/Debian/Debhelper/Dh_Getopt.pm
+++ b/Debian/Debhelper/Dh_Getopt.pm
@@ -68,6 +68,11 @@ sub AddIgnore { my($option,$file)=@_;
$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}}, @_;
@@ -180,6 +185,7 @@ sub parseopts {
"after=s" => \$options{AFTER},
"before=s" => \$options{BEFORE},
"remaining" => \$options{REMAINING},
+ "with=s" => \&AddWith,
"<>" => \&NonOption,
);
diff --git a/Debian/Debhelper/Sequence/python_support.pm b/Debian/Debhelper/Sequence/python_support.pm
new file mode 100644
index 00000000..3d03ebb3
--- /dev/null
+++ b/Debian/Debhelper/Sequence/python_support.pm
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+# debhelper sequence file for python-support
+
+use warnings;
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+# Test if dh_pysupport is available before inserting it.
+# (This would not be needed if this file was contained in the python-support
+# package.)
+if (-x "/usr/bin/dh_pysupport") {
+ insert_after("dh_perl", "dh_pysupport");
+}
+
+1
diff --git a/Makefile b/Makefile
index 5d64ab95..6cf714cd 100644
--- a/Makefile
+++ b/Makefile
@@ -63,10 +63,11 @@ clean:
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/*
diff --git a/debian/changelog b/debian/changelog
index e16b8a30..c18bb7e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+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
diff --git a/dh b/dh
index df5bccd8..fec1debb 100755
--- a/dh
+++ b/dh
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
=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
@@ -54,6 +54,14 @@ Run commands in the sequence that come after I<cmd>.
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
@@ -67,6 +75,22 @@ search for a command in the sequence exactly matching the name, to avoid any
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 {
@@ -230,7 +254,6 @@ $sequences{install} = [@{$sequences{build}}, qw{
dh_gconf
dh_icons
dh_perl
- dh_pysupport
dh_scrollkeeper
dh_usrlocal
@@ -252,12 +275,45 @@ $sequences{binary} = [@{$sequences{install}}, qw{
}, @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) {
@@ -378,11 +434,6 @@ sub run {
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";