]> git.donarmstrong.com Git - debhelper.git/commitdiff
dh: Inhibit logging for commands run inside override targets
authorJoey Hess <joey@kitenet.net>
Wed, 3 Nov 2010 02:48:01 +0000 (22:48 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 3 Nov 2010 02:51:33 +0000 (22:51 -0400)
Note that only the overridden command is inhibited. I wanted to avoid a
behavior change if a rules file runs other debhelper commands inside the
target, and relies on the logging preventing them being run later on in
the sequence.

Debian/Debhelper/Dh_Lib.pm
debian/changelog
dh

index 3c23e092beb9cf0f215338eeec83cc638719d805..fb83480b5324b69182c26fcc2e17587e1678332b 100644 (file)
@@ -125,6 +125,8 @@ sub write_log {
        my $cmd=shift;
        my @packages=@_;
 
+       return if defined $ENV{DH_INHIBIT_LOG} && $cmd eq $ENV{DH_INHIBIT_LOG};
+
        foreach my $package (@packages) {
                my $ext=pkgext($package);
                my $log="debian/${ext}debhelper.log";
index a95186575c6082cfacc56f2bdf4c277740ae228f..a0ae5e1fb8c1581282f23c3956d6f3c812fe71cc 100644 (file)
@@ -20,6 +20,9 @@ debhelper (8.1.0) UNRELEASED; urgency=low
   * Massive man page typography patch. Closes: #600883
     (Thanks, David Prévot)
   * Explicitly build-depend on a new enough perl-base. Closes: #601188
+  * dh: Inhibit logging when an override target runs the overridden command,
+    to avoid unexpected behavior if the command succeeded but the overall
+    target fails. Closes: #601037
 
  -- Joey Hess <joeyh@debian.org>  Sat, 07 Aug 2010 11:27:24 -0400
 
diff --git a/dh b/dh
index f267a326825b3f71a4770f5966361d43fddaa963..d2771abbbf83cc764d14edabc234de2e2901ade7 100755 (executable)
--- a/dh
+++ b/dh
@@ -635,6 +635,9 @@ 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;
                        $command="debian/rules";
                        @options="override_".$override_command;
                }
@@ -669,9 +672,9 @@ sub run {
 
                if (defined $override_command) {
                        delete $ENV{DH_INTERNAL_OPTIONS};
-                       # Need to handle logging for overriden commands here,
-                       # because the actual debhelper command may not have
-                       # been run by the rules file target.
+                       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
                        # the log earlier.)
                        if ($override_command ne 'dh_clean') {