[debhelper-devel] [debhelper] 01/02: dh_builddeb: Use the new code for running in parallel

Niels Thykier nthykier at moszumanska.debian.org
Sat Jun 24 12:46:22 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 1597d1af81892642c7854fc95b28826975bf9a79
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Jun 24 12:45:10 2017 +0000

    dh_builddeb: Use the new code for running in parallel
    
    Re-indent pending next comment.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  2 ++
 dh_builddeb      | 32 +++-----------------------------
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 405b1ae..b1317df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,8 @@ debhelper (10.5) UNRELEASED; urgency=medium
   * dh_compress: Ditto.
   * dh_installman: Ditto.
   * dh_genchanges: Ditto.
+  * dh_builddeb: Rewrite the hand-written parallel code to use the new
+    simplier way of doing it.
   * dh_shlibdeps: Avoid calling file(1) on debug symbols.
   * SUPPORT-POLICY: Include new document that describes the current
     support policy of debhelper compat levels.
diff --git a/dh_builddeb b/dh_builddeb
index 9d20dc7..55ceeea 100755
--- a/dh_builddeb
+++ b/dh_builddeb
@@ -68,20 +68,6 @@ else {
 	$dh{FILENAME}="/$dh{FILENAME}";
 }
 
-my $max_procs=get_buildoption("parallel") || 1;
-
-my $processes=1;
-my $exit=0;
-sub reap {
-	if (wait == -1) {
-		$processes=0;
-	}
-	else {
-		$processes--;
-		$exit=1 if $? != 0;
-	}
-}
-
 sub default_compressor_args {
 	my ($default_comp, @args) = @_;
 
@@ -118,17 +104,8 @@ sub build_and_rename_deb {
 		"${destdir}/${desired_filename}");
 }
 
-foreach my $package (@{$dh{DOPACKAGES}}) {
-	my $pid=fork();
-	if (! defined $pid) {
-		error("fork failed! $!");
-	}
-	if ($pid) { # parent
-		$processes++;
-		reap while $processes > $max_procs;
-		next;
-	}
-
+on_pkgs_in_parallel {
+foreach my $package (@_) {
 	# child
 	my $tmp=tmpdir($package);
 	my $dbgsym_tmpdir = "debian/.debhelper/${package}/dbgsym-root";
@@ -183,11 +160,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			doit(@cmd, $dh{DESTDIR}.$filename);
 		}
 	}
-	exit 0;
 }
-
-reap while $processes;
-exit $exit;
+};
 
 =head1 SEE ALSO
 

-- 
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