[debhelper-devel] [Git][debian/debhelper][master] Buildsystem.pm: Add a getter for targetbuildsystem

Niels Thykier gitlab at salsa.debian.org
Sat Apr 7 08:46:54 UTC 2018


Niels Thykier pushed to branch master at Debian / debhelper


Commits:
14f31b2f by Niels Thykier at 2018-04-07T08:44:48+00:00
Buildsystem.pm: Add a getter for targetbuildsystem

Signed-off-by: Niels Thykier <niels at thykier.net>

- - - - -


4 changed files:

- lib/Debian/Debhelper/Buildsystem.pm
- lib/Debian/Debhelper/Buildsystem/cmake.pm
- lib/Debian/Debhelper/Buildsystem/meson.pm
- lib/Debian/Debhelper/Dh_Buildsystems.pm


Changes:

=====================================
lib/Debian/Debhelper/Buildsystem.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem.pm
+++ b/lib/Debian/Debhelper/Buildsystem.pm
@@ -186,7 +186,14 @@ sub set_targetbuildsystem {
 		my $name = $this->NAME;
 		error("Buildsystem ${name} does not support ${target_bs_name} as target build system.");
 	}
-	$this->{targetbuildsystem} = $target_system
+	$this->{'targetbuildsystem'} = $target_system
+}
+
+# Returns the target build system if it is provided
+sub get_targetbuildsystem {
+	my $this = shift;
+	return if not exists($this->{'targetbuildsystem'});
+	return $this->{'targetbuildsystem'};
 }
 
 # This instance method is called to check if the build system is able
@@ -498,7 +505,7 @@ sub pre_building_step {
 		delete $this->{warn_insource};
 	}
 	if ($this->IS_GENERATOR_BUILD_SYSTEM) {
-		$this->{targetbuildsystem}->pre_building_step(@_);
+		$this->get_targetbuildsystem->pre_building_step(@_);
 	}
 }
 
@@ -509,7 +516,7 @@ sub post_building_step {
 	my $this=shift;
 	my ($step)=@_;
 	if ($this->IS_GENERATOR_BUILD_SYSTEM) {
-		$this->{targetbuildsystem}->post_building_step(@_);
+		$this->get_targetbuildsystem->post_building_step(@_);
 	}
 }
 
@@ -532,14 +539,14 @@ sub configure {
 sub build {
 	my $this=shift;
 	if ($this->IS_GENERATOR_BUILD_SYSTEM) {
-		$this->{targetbuildsystem}->build(@_);
+		$this->get_targetbuildsystem->build(@_);
 	}
 }
 
 sub test {
 	my $this=shift;
 	if ($this->IS_GENERATOR_BUILD_SYSTEM) {
-		$this->{targetbuildsystem}->test(@_);
+		$this->get_targetbuildsystem->test(@_);
 	}
 }
 
@@ -549,7 +556,7 @@ sub install {
 	my ($destdir) = @_;
 
 	if ($this->IS_GENERATOR_BUILD_SYSTEM) {
-		$this->{targetbuildsystem}->install(@_);
+		$this->get_targetbuildsystem->install(@_);
 	}
 }
 
@@ -557,7 +564,7 @@ sub clean {
 	my $this=shift;
 
 	if ($this->IS_GENERATOR_BUILD_SYSTEM) {
-		$this->{targetbuildsystem}->clean(@_);
+		$this->get_targetbuildsystem->clean(@_);
 	}
 }
 


=====================================
lib/Debian/Debhelper/Buildsystem/cmake.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem/cmake.pm
+++ b/lib/Debian/Debhelper/Buildsystem/cmake.pm
@@ -49,7 +49,7 @@ sub check_auto_buildable {
 	my ($step)=@_;
 	if (-e $this->get_sourcepath("CMakeLists.txt")) {
 		my $ret = ($step eq "configure" && 1) ||
-		          $this->{targetbuildsystem}->check_auto_buildable(@_);
+		          $this->get_targetbuildsystem->check_auto_buildable(@_);
 		if ($step eq "clean" && defined($this->get_builddir())) {
 			# Assume that the package can be cleaned (i.e. the build directory can
 			# be removed) as long as it is built out-of-source tree and can be
@@ -76,7 +76,7 @@ sub configure {
 	my $this=shift;
 	# Standard set of cmake flags
 	my @flags = @STANDARD_CMAKE_FLAGS;
-	my $backend = $this->{targetbuildsystem}->NAME;
+	my $backend = $this->get_targetbuildsystem->NAME;
 
 	if (not compat(10)) {
 		push(@flags, '-DCMAKE_INSTALL_RUNSTATEDIR=/run');
@@ -135,7 +135,7 @@ sub configure {
 
 sub test {
 	my $this=shift;
-	my $target = $this->{targetbuildsystem};
+	my $target = $this->get_targetbuildsystem;
 	$ENV{CTEST_OUTPUT_ON_FAILURE} = 1;
 	if ($target->NAME eq 'makefile') {
 		# Unlike make, CTest does not have "unlimited parallel" setting (-j implies


=====================================
lib/Debian/Debhelper/Buildsystem/meson.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem/meson.pm
+++ b/lib/Debian/Debhelper/Buildsystem/meson.pm
@@ -31,7 +31,7 @@ sub check_auto_buildable {
 
 	# Handle configure explicitly; inherit the rest
 	return 1 if $step eq "configure";
-	my $ret = $this->{targetbuildsystem}->check_auto_buildable(@_);
+	my $ret = $this->get_targetbuildsystem->check_auto_buildable(@_);
 	if ($ret == 0 and $step eq 'clean' and defined($this->get_builddir())) {
 		# Assume that the package can be cleaned (i.e. the build directory can
 		# be removed) as long as it is built out-of-source tree and can be


=====================================
lib/Debian/Debhelper/Dh_Buildsystems.pm
=====================================
--- a/lib/Debian/Debhelper/Dh_Buildsystems.pm
+++ b/lib/Debian/Debhelper/Dh_Buildsystems.pm
@@ -87,7 +87,7 @@ sub autoselect_buildsystem {
 		if (defined($selected)) {
 			my $ok = $inst->isa(ref($selected)) ? 1 : 0;
 			if (not $ok and $inst->IS_GENERATOR_BUILD_SYSTEM) {
-				$ok = 1 if $inst->{targetbuildsystem}->NAME eq $selected->NAME;
+				$ok = 1 if $inst->get_targetbuildsystem->NAME eq $selected->NAME;
 			}
 			next if not $ok;
 		}



View it on GitLab: https://salsa.debian.org/debian/debhelper/commit/14f31b2feb385292cfba63abeba542c02def7de3

---
View it on GitLab: https://salsa.debian.org/debian/debhelper/commit/14f31b2feb385292cfba63abeba542c02def7de3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/debhelper-devel/attachments/20180407/fe2c77dd/attachment-0001.html>


More information about the debhelper-devel mailing list