diff options
-rw-r--r-- | debian/changelog | 6 | ||||
-rwxr-xr-x | dh | 32 |
2 files changed, 37 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog index cf1bcd3a..7df41d4d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +debhelper (7.3.14) UNRELEASED; urgency=low + + * dh: Add --list option to list available addons. + + -- Colin Watson <cjwatson@debian.org> Thu, 13 Aug 2009 09:00:24 +0100 + debhelper (7.3.13) unstable; urgency=low [ Bernd Zeimetz ] @@ -8,10 +8,11 @@ dh - debhelper command sequencer use strict; use Debian::Debhelper::Dh_Lib; +use File::Spec; =head1 SYNOPSIS -B<dh> sequence [B<--with> I<addon>[,I<addon>,...]] [B<--until> I<cmd>] [B<--before> I<cmd>] [B<--after> I<cmd>] [B<--remaining>] [S<I<debhelper options>>] +B<dh> sequence [B<--with> I<addon>[,I<addon>,...]] [B<--list>] [B<--until> I<cmd>] [B<--before> I<cmd>] [B<--after> I<cmd>] [B<--remaining>] [S<I<debhelper options>>] =head1 DESCRIPTION @@ -58,6 +59,10 @@ the sequence addon interface. The inverse of --with, disables using the given addon. +=item B<--list>, B<-l> + +List all available addons. + =item B<--until> I<cmd> Run commands in the sequence until and including I<cmd>, then stop. @@ -216,6 +221,8 @@ init(options => { my ($option,$value)=@_; @{$dh{WITH}} = grep { $_ ne $value } @{$dh{WITH}}; }, + "l" => \$dh{LIST}, + "list" => \$dh{LIST}, }); inhibit_log(); @@ -327,6 +334,29 @@ sub add_command { my $sequence=shift; unshift @{$sequences{$sequence}}, $command; } + +if ($dh{LIST}) { + my %addons; + + for my $inc (@INC) { + my $path = File::Spec->catdir($inc, "Debian/Debhelper/Sequence"); + if (-d $path) { + for my $module_path (glob "$path/*.pm") { + my $name = basename($module_path); + $name =~ s/\.pm$//; + $name =~ s/_/-/g; + $addons{$name} = 1; + } + } + } + + for my $name (sort keys %addons) { + print "$name\n"; + } + + exit 0; +} + foreach my $addon (@{$dh{WITH}}) { my $mod="Debian::Debhelper::Sequence::$addon"; $mod=~s/-/_/g; |