[debhelper-devel] [debhelper] 01/01: Add support for parallel=N and DH_QUIET

Michael Biebl biebl at moszumanska.debian.org
Wed Mar 29 03:26:47 UTC 2017


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

biebl pushed a commit to branch biebl/meson
in repository debhelper.

commit 37e0a8aef7404fb9cdbc7855db19393edaa1dc99
Author: Michael Biebl <biebl at debian.org>
Date:   Wed Mar 29 05:26:01 2017 +0200

    Add support for parallel=N and DH_QUIET
---
 Debian/Debhelper/Buildsystem/ninja.pm | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/Debian/Debhelper/Buildsystem/ninja.pm b/Debian/Debhelper/Buildsystem/ninja.pm
index 3acfb84..fd73416 100644
--- a/Debian/Debhelper/Buildsystem/ninja.pm
+++ b/Debian/Debhelper/Buildsystem/ninja.pm
@@ -7,7 +7,7 @@ package Debian::Debhelper::Buildsystem::ninja;
 
 use strict;
 use warnings;
-use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value);
+use Debian::Debhelper::Dh_Lib qw(%dh dpkg_architecture_value);
 use parent qw(Debian::Debhelper::Buildsystem);
 
 sub DESCRIPTION {
@@ -44,20 +44,22 @@ sub check_auto_buildable {
 
 sub build {
 	my $this=shift;
-	unshift @_,
 
-	# TODO: Add support for DEB_BUILD_OPTIONS="parallel=N"?
-	# By default ninja runs N jobs in parallel, where N is derived
-	# from the number of CPUs.
-	# Should this be only done for the build step or install and test as well?
-	# In the latter case, the code to run buildcmd should be factored out.
-
-	# TODO: Add support for DH_QUIET, i.e. don't run with -v in quiet mode.
-	$this->doit_in_builddir($this->{buildcmd}, "-v", @_);
+	if (!$dh{QUIET}) {
+		unshift @_, "-v";
+	}
+	if ($this->get_parallel() > 0) {
+		unshift @_, "-j" . $this->get_parallel();
+	}
+	$this->doit_in_builddir($this->{buildcmd}, @_);
 }
 
 sub test {
 	my $this=shift;
+
+	if ($this->get_parallel() > 0) {
+		$ENV{MESON_TESTTHREADS} = $this->get_parallel();
+	}
 	$this->doit_in_builddir($this->{buildcmd}, "test", @_);
 }
 
@@ -65,14 +67,13 @@ sub install {
 	my $this=shift;
 	my $destdir=shift;
 
-	# TODO: DESTDIR can only be set as environment variable. Save and restore
-	# $ENV after calling the install target?
 	$ENV{DESTDIR}=$destdir;
 	$this->doit_in_builddir($this->{buildcmd}, "install", @_);
 }
 
 sub clean {
 	my $this=shift;
+
 	if (!$this->rmdir_builddir()) {
 		$this->doit_in_builddir($this->{buildcmd}, "clean", @_);
 	}

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