]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh
dh: Fix man page typos. Closes: #477933
[debhelper.git] / dh
diff --git a/dh b/dh
index 2c36c95563e842d15762fdb6334937c740e93a49..df5bccd84c07a62c6c02855a2ba1d6e8a639d2e7 100755 (executable)
--- 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>] [S<I<debhelper options>>]
 
 =head1 DESCRIPTION
 
@@ -24,10 +24,6 @@ they only work on binary independent packages, and commands in the
 binary-arch sequences are passed the "-a" option to ensure they only work
 on architecture dependent packages.
 
-Options passed to dh are passed on to each command it runs. This can be
-used to set an option like "-v" or "-X" or "-N", as well as for more
-specialised options.
-
 Each debhelper command will record when it's successfully run in
 debian/package.debhelper.log. (Which dh_clean deletes.) So dh can tell
 which commands have already been run, for which packages, and skip running
@@ -58,6 +54,12 @@ Run commands in the sequence that come after I<cmd>.
 
 Run all commands in the sequence that have yet to be run.
 
+=back
+
+All other options passed to dh are passed on to each command it runs. This
+can be used to set an option like "-v" or "-X" or "-N", as well as for more
+specialised options.
+
 =head1 COMMAND SPECIFICATION
 
 I<cmd> can be a full name of a debhelper command, or a substring. It'll first
@@ -103,7 +105,7 @@ commands work with no additional options.
 
        #!/usr/bin/make -f
        %:
-               dh %@
+               dh $@
 
 This is a simple rules file that is a good starting place for customisation.
 (It's also available in F</usr/share/doc/debhelper/examples/rules.simple>
@@ -157,11 +159,13 @@ debhelper command is run.
                # and continue
                dh install --after dh_fixperms
 
-It's also fine to run debhelper commands before starting a dh sequence.
-Just be sure to use the B<--remaining> option to ensure that commands
-that normally come before those in the sequence are still run.
+It's also fine to run debhelper commands early. Just make sure that at
+least dh_prep is run from the squence first, and be sure to use the
+B<--remaining> option to ensure that commands that normally come before
+those in the sequence are still run.
 
        install:
+               dh install --until dh_prep
                dh_installdocs README TODO
                dh_installchangelogs Changes
                dh install --remaining
@@ -250,10 +254,10 @@ $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=(
-       dh_pycompat => 1,
-       dh_pysupport => 1,
-);
+my %thirdparty=map { $_ => 1 } qw{
+       dh_pycentral
+       dh_pysupport
+};
 
 # Get the sequence of commands to run.
 if (! @ARGV) {
@@ -266,14 +270,24 @@ if (! exists $sequences{$sequence}) {
 }
 my @sequence=@{$sequences{$sequence}};
 
+# The list of all packages that can be acted on.
+my @packages=@{$dh{DOPACKAGES}};
+
 # Get the options to pass to commands in the sequence.
 # Filter out options intended only for this program.
 my @options;
 if ($sequence eq 'binary-arch') {
        push @options, "-a";
+       # as an optimisation, remove from the list any packages
+       # that are not arch dependent
+       my %arch_packages = map { $_ => 1 } getpackages("arch");
+       @packages = grep { $arch_packages{$_} } @packages;
 }
 elsif ($sequence eq 'binary-indep') {
        push @options, "-i";
+       # ditto optimisation for arch indep
+       my %indep_packages = map { $_ => 1 } getpackages("indep");
+       @packages = grep { $indep_packages{$_} } @packages;
 }
 while (@ARGV_orig) {
        my $opt=shift @ARGV_orig;
@@ -282,7 +296,7 @@ while (@ARGV_orig) {
                shift @ARGV_orig;
                next;
        }
-       elsif ($opt =~ /^--?(remaining|(after|until|before)=)/) {
+       elsif ($opt =~ /^--?(no-act|remaining|(after|until|before)=)/) {
                next;
        }
        push @options, $opt;
@@ -291,7 +305,7 @@ while (@ARGV_orig) {
 # Figure out at what point in the sequence to start for each package.
 my %logged;
 my %startpoint;
-foreach my $package (@{$dh{DOPACKAGES}}) {
+foreach my $package (@packages) {
        my @log=loadlog($package);
        if ($dh{AFTER}) {
                # Run commands in the sequence that come after the
@@ -338,14 +352,14 @@ elsif ($dh{BEFORE}) {
 foreach my $i (0..$stoppoint) {
        # Figure out which packages need to run this command.
        my @exclude;
-       foreach my $package (@{$dh{DOPACKAGES}}) {
+       foreach my $package (@packages) {
                if ($startpoint{$package} > $i ||
                    $logged{$package}{$sequence[$i]}) {
                        push @exclude, $package;
                }
        }
        
-       if (@exclude eq @{$dh{DOPACKAGES}}) {
+       if (@exclude eq @packages) {
                # Command already done for all packages.
                next;
        }