]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh
Fix example. Closes: #627534
[debhelper.git] / dh
diff --git a/dh b/dh
index 5537db4cebe50098a2c09118e5f7901f6add08fd..50e0f14dbd90895295b82c98d08627da0aba349b 100755 (executable)
--- a/dh
+++ b/dh
@@ -240,16 +240,19 @@ L<dh_listpackages(1)> to test what is being built. For example:
        endif
 
 Finally, remember that you are not limited to using override targets in the
-rules file when using B<dh>. You can also explicitly define any of the regular
+rules file when using B<dh>. You can also explicitly define the regular
 rules file targets when it makes sense to do so. A common reason to do this
-is if your package needs different B<build-arch> and B<build-indep> targets. For
-example, a package with a long document build process can put it in
-B<build-indep> to avoid build daemons redundantly building the documentation.
+is if your package needs different B<build-arch> and B<build-indep> targets.
+For example, a package with a long document build process can put it in
+B<build-indep>.
 
        #!/usr/bin/make -f
        %:
                dh $@
        
+       binary: binary-arch binary-indep ;
+       binary-arch:: build-arch
+       binary-indep:: build-indep
        build: build-arch build-indep ;
        build-indep:
                $(MAKE) docs
@@ -270,16 +273,6 @@ that is in the specified sequence. It then continues with the next command
 in the sequence. The B<--until>, B<--before>, B<--after>, and B<--remaining>
 options can override this behavior.
 
-A sequence can also have dependencies.  For example, the "binary"
-sequence depends upon the "binary-arch" and "binary-indep" sequences,
-and the "binary-arch" sequence depends upon the "install-arch"
-sequence which in turn depends upon the "build-arch" sequence.  These
-will, by default, be run via "debian/rules <sequence>" and so may be
-overridden or extended there, or else will run dh again to execute the
-depending sequence.  For example, "dh binary-arch" will run
-"debian/rules install-arch" which will run "dh install-arch" unless a
-custom install-arch target replaces the default target.
-
 B<dh> uses the B<DH_INTERNAL_OPTIONS> environment variable to pass information
 through to debhelper commands that are run inside override targets. The
 contents (and indeed, existence) of this environment variable, as the name
@@ -328,15 +321,14 @@ if (is_make_jobserver_unavailable()) {
 
 # Definitions of sequences.
 my %sequences;
-my @bd = qw{
+$sequences{build} = [qw{
        dh_testdir
        dh_auto_configure
        dh_auto_build
        dh_auto_test
-};
-$sequences{build} = [@bd];
-$sequences{'build-indep'} = [@bd];
-$sequences{'build-arch'} = [@bd];
+}],
+$sequences{'build-indep'} = [@{$sequences{build}}];
+$sequences{'build-arch'} = [@{$sequences{build}}];
 $sequences{clean} = [qw{
        dh_testdir
        dh_auto_clean
@@ -371,7 +363,9 @@ my @i = qw{
        dh_installudev
        dh_installwm
        dh_installxfonts
+       dh_installgsettings
        dh_bugfiles
+       dh_ucf
        dh_lintian
        dh_gconf
        dh_icons
@@ -382,9 +376,9 @@ my @i = qw{
        dh_compress
        dh_fixperms
 };
-$sequences{'install'} = [@i];
-$sequences{'install-indep'} = [@i];
-$sequences{'install-arch'} = [@i];
+$sequences{'install'} = [@{$sequences{build}}, @i];
+$sequences{'install-indep'} = [@{$sequences{'build-indep'}}, @i];
+$sequences{'install-arch'} = [@{$sequences{'build-arch'}}, @i];
 my @ba=qw{
        dh_strip
        dh_makeshlibs
@@ -396,19 +390,9 @@ my @b=qw{
        dh_md5sums
        dh_builddeb
 };
-$sequences{binary} = [@ba, @b];
-$sequences{'binary-indep'} = [@b];
-$sequences{'binary-arch'} = [@ba, @b];
-
-# Sequence dependencies
-my %sequence_deps;
-$sequence_deps{build} = ['build-arch', 'build-indep'];
-$sequence_deps{install} = ['install-arch', 'install-indep'];
-$sequence_deps{'install-arch'} = ['build-arch'];
-$sequence_deps{'install-indep'} = ['build-indep'];
-$sequence_deps{binary} = ['binary-arch', 'binary-indep'];
-$sequence_deps{'binary-arch'} = ['install-arch'];
-$sequence_deps{'binary-indep'} = ['install-indep'];
+$sequences{binary} = [@{$sequences{install}}, @ba, @b];
+$sequences{'binary-indep'} = [@{$sequences{'install-indep'}}, @b];
+$sequences{'binary-arch'} = [@{$sequences{'install-arch'}}, @ba, @b];
 
 # Additional command options
 my %command_opts;
@@ -537,29 +521,6 @@ elsif (! exists $sequences{$sequence}) {
 }
 my @sequence=@{$sequences{$sequence}};
 
-# Recursively invoke sequence dependencies before any further processing.
-# The dh options are not passed in the environment, to ensure that the
-# behaviour is the same if invoked directly.
-my $deps = undef;
-$deps = $sequence_deps{$sequence}
-       if (exists($sequence_deps{$sequence}));
-if (defined($deps)) {
-       foreach my $dep (@$deps) {
-               my $command = 'debian/rules';
-               my @dep_options = ($dep);
-               print "   ".escape_shell($command, @dep_options)."\n";
-               if (! $dh{NO_ACT}) {
-                       my $ret=system($command, @dep_options);
-                       if ($ret >> 8 != 0) {
-                               exit $ret >> 8;
-                       }
-                       elsif ($ret) {
-                               exit 1;
-                       }
-               }
-       }
-}
-
 # The list of all packages that can be acted on.
 my @packages=@{$dh{DOPACKAGES}};
 
@@ -691,9 +652,7 @@ sub run {
                        # This passes the options through to commands called
                        # inside the target.
                        $ENV{DH_INTERNAL_OPTIONS}=join("\x1e", @options);
-                       # Prevent commands called inside the target from
-                       # logging.
-                       $ENV{DH_INHIBIT_LOG}=$command;
+                       $ENV{DH_INTERNAL_OVERRIDE}=$command;
                        $command="debian/rules";
                        @options="override_".$override_command;
                }
@@ -714,10 +673,11 @@ sub run {
        else {
                print "   ", "# Skipping ", $override_command, " - empty override", "\n";
        }
-
+                               
        if (! $dh{NO_ACT}) {
                if (defined $command) {
                        my $ret=system($command, @options);
+                       
                        if ($ret >> 8 != 0) {
                                exit $ret >> 8;
                        }
@@ -727,8 +687,6 @@ sub run {
                }
 
                if (defined $override_command) {
-                       delete $ENV{DH_INTERNAL_OPTIONS};
-                       delete $ENV{DH_INHIBIT_LOG};
                        # Update log for overridden command now that it has
                        # finished successfully.
                        # (But avoid logging for dh_clean since it removes
@@ -737,7 +695,11 @@ sub run {
                                my %packages=map { $_ => 1 } @packages;
                                map { delete $packages{$_} } @exclude;
                                write_log($override_command, keys %packages);
+                               commit_override_log(keys %packages);
                        }
+
+                       delete $ENV{DH_INTERNAL_OPTIONS};
+                       delete $ENV{DH_INTERNAL_OVERRIDE};
                }
        }
 }