[debhelper-devel] [debhelper] 02/02: Buildsystem: Add complex_doit_in_builddir

Niels Thykier nthykier at moszumanska.debian.org
Sat Jul 22 17:06:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 307a07e892b825fd1ad05766ad43f1f2748bf806
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Jul 22 17:05:28 2017 +0000

    Buildsystem: Add complex_doit_in_builddir
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Buildsystem.pm |  5 +++++
 Debian/Debhelper/Dh_Lib.pm      | 15 +++++++++++++++
 debian/changelog                |  3 +++
 3 files changed, 23 insertions(+)

diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm
index 26b0813..9dea85e 100644
--- a/Debian/Debhelper/Buildsystem.pm
+++ b/Debian/Debhelper/Buildsystem.pm
@@ -349,6 +349,11 @@ sub doit_in_builddir_noerror {
 	return $this->_in_dir($this->get_buildpath, \&print_and_doit_noerror, @args);
 }
 
+sub complex_doit_in_builddir {
+	my ($this, @args) = @_;
+	return $this->_in_dir($this->get_buildpath, \&print_and_complex_doit, @args);
+}
+
 # In case of out of source tree building, whole build directory
 # gets wiped (if it exists) and 1 is returned. If build directory
 # had 2 or more levels, empty parent directories are also deleted.
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 95b8f13..312e727 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -63,6 +63,7 @@ our (@EXPORT, %dh);
 	    XARGS_INSERT_PARAMS_HERE &glob_expand_error_handler_reject
 	    &glob_expand_error_handler_warn_and_discard &glob_expand
 	    &glob_expand_error_handler_silently_ignore DH_BUILTIN_VERSION
+	    &print_and_complex_doit
 );
 
 # The Makefile changes this if debhelper is installed in a PREFIX.
@@ -328,6 +329,20 @@ sub complex_doit {
 	}			
 }
 
+# Run a command and display the command to stdout except when quiet
+# Use print_and_doit() if you can, instead of this function, because
+# this function forks a shell. However, this function can handle more
+# complicated stuff like redirection.
+sub print_and_complex_doit {
+	nonquiet_print(join(" ", at _));
+
+	if (! $dh{NO_ACT}) {
+		# The join makes system get a scalar so it forks off a shell.
+		system(join(" ", @_)) == 0 || error_exitcode(join(" ", @_))
+	}
+}
+
+
 sub error_exitcode {
 	my $command=shift;
 	if ($? == -1) {
diff --git a/debian/changelog b/debian/changelog
index 458c891..b034ceb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ debhelper (10.7) UNRELEASED; urgency=medium
   * dh_installmodules: Ensure maintscripts are reproducible even with
     multiple kernel versions detected.
   * Apply patches from gregor herrmann to improve autopkgtests.
+  * Dh_Lib: Introduce a print_and_complex_doit.
+  * Buildsystem: Introduce a complex_doit_in_builddir, which is needed
+    by gradle-debian-helper.
 
  -- Niels Thykier <niels at thykier.net>  Sat, 15 Jul 2017 09:42:32 +0000
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list