X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh;h=bdd78c52591ab68bc94ddc968ded73c2fddecd7f;hb=25ef5b07c717efe64882bee86f38e817520a3b90;hp=701f588e643378c4a0097a1a5e6ee5238389786b;hpb=4e6b4536d7611a303b4e57de932dce5bd07ee93f;p=debhelper.git diff --git a/dh b/dh index 701f588..bdd78c5 100755 --- a/dh +++ b/dh @@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS -B sequence [B<--with> I[,I,...]] [B<--until> I] [B<--before> I] [B<--after> I] [B<--remaining>] [S>] +B sequence [B<--with> I[,I,...]] [B<--list>] [B<--until> I] [B<--before> I] [B<--after> I] [B<--remaining>] [S>] =head1 DESCRIPTION @@ -58,6 +58,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 Run commands in the sequence until and including I, then stop. @@ -179,6 +183,16 @@ sequence addons like this: %: dh --with quilt $@ +Here is an example of overriding where the dh_auto_* commands find +the package's source, for a package where the source is located in a +subdirectory. It also forces use of perl's Module::Build build system, +which can be necessary if debhelper wrongly detects that the package +uses MakeMaker. + + #!/usr/bin/make -f + %: + dh --sourcedirectory=src --buildsystem=perl_build $@ + =cut # Stash this away before init modifies it. @@ -187,6 +201,11 @@ my @ARGV_orig=@ARGV; # python-support is enabled by default, at least for now # (and comes first so python-central loads later and can disable it). unshift @ARGV, "--with=python-support"; + +# Disable complaints about unknown options for both dh and the commands +# it runs. This is done because dh accepts and passes on options that may +# be specific to only some debhelper commands. +$ENV{DH_IGNORE_UNKNOWN_OPTIONS}=1; init(options => { "until=s" => \$dh{UNTIL}, @@ -201,6 +220,8 @@ init(options => { my ($option,$value)=@_; @{$dh{WITH}} = grep { $_ ne $value } @{$dh{WITH}}; }, + "l" => \$dh{LIST}, + "list" => \$dh{LIST}, }); inhibit_log(); @@ -252,7 +273,6 @@ $sequences{install} = [@{$sequences{build}}, qw{ dh_gconf dh_icons dh_perl - dh_scrollkeeper dh_usrlocal dh_link @@ -308,12 +328,41 @@ sub remove_command { } } +sub add_command { + my $command=shift; + my $sequence=shift; + unshift @{$sequences{$sequence}}, $command; +} + +if ($dh{LIST}) { + my %addons; + + for my $inc (@INC) { + eval q{use File::Spec}; + 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; eval "use $mod"; if ($@) { - error("--with $addon not supported or failed to load module $mod"); + error("unable to load addon $addon: $@"); } } @@ -448,7 +497,7 @@ sub run { $override_command=$command; # This passes the options through to commands called # inside the target. - $ENV{DH_INTERNAL_OPTIONS}=join(" ", @options); + $ENV{DH_INTERNAL_OPTIONS}=join("\x1e", @options); $command="debian/rules"; @options="override_".$override_command; } @@ -471,9 +520,13 @@ sub run { # Need to handle logging for overriden commands here, # because the actual debhelper command may not have # been run by the rules file target. - my %packages=map { $_ => 1 } @packages; - map { delete $packages{$_} } @exclude; - write_log($override_command, keys %packages); + # (But avoid logging for dh_clean since it removes + # the log earlier.) + if ($override_command ne 'dh_clean') { + my %packages=map { $_ => 1 } @packages; + map { delete $packages{$_} } @exclude; + write_log($override_command, keys %packages); + } } } }