[debhelper-devel] [debhelper] 02/11: Convert prefix usage to get_buildprefix

Niels Thykier nthykier at moszumanska.debian.org
Sun Jan 7 21:38:02 UTC 2018


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

nthykier pushed a commit to annotated tag Release_2.6.0
in repository debhelper.

commit b38ac9c33da1749f3b42000cd9d3c5f89558220a
Author: Dan Nicholson <nicholson at endlessm.com>
Date:   Thu Jan 28 06:33:38 2016 -0800

    Convert prefix usage to get_buildprefix
    
    Clean up the repeated prefix construction by calling get_buildprefix
    instead. This reduces some repeated work and will make adding xdg-app
    support easier. A couple hunks have been moved around to make the diff
    with upstream smaller.
---
 Debian/Debhelper/Buildsystem/autoconf.pm         | 24 ++++++++++--------------
 Debian/Debhelper/Buildsystem/cmake.pm            | 17 ++++++-----------
 Debian/Debhelper/Buildsystem/python_distutils.pm | 13 +++++--------
 Debian/Debhelper/Buildsystem/qmake.pm            | 11 ++---------
 dh_install                                       | 19 +++++++------------
 dh_installdirs                                   |  7 +++----
 6 files changed, 33 insertions(+), 58 deletions(-)

diff --git a/Debian/Debhelper/Buildsystem/autoconf.pm b/Debian/Debhelper/Buildsystem/autoconf.pm
index 2eed6a3..dfee24c 100644
--- a/Debian/Debhelper/Buildsystem/autoconf.pm
+++ b/Debian/Debhelper/Buildsystem/autoconf.pm
@@ -8,7 +8,7 @@ package Debian::Debhelper::Buildsystem::autoconf;
 
 use strict;
 use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value sourcepackage compat
-				 get_buildprofile package_eos_app_id);
+				 get_buildprefix);
 use base 'Debian::Debhelper::Buildsystem::makefile';
 
 sub DESCRIPTION {
@@ -32,22 +32,18 @@ sub configure {
 	# Standard set of options for configure.
 	my @opts;
 	push @opts, "--build=" . dpkg_architecture_value("DEB_BUILD_GNU_TYPE");
-	if (get_buildprofile("eos-app")) {
-		# Build with the app id of the main package by default
-		my $app_prefix=package_eos_app_id();
-
-		push @opts, "--prefix=/endless/" . $app_prefix;
-		push @opts, "--sysconfdir=\${prefix}/etc";
-		push @opts, "--localstatedir=\${prefix}/var";
-	}
-	else {
-		push @opts, "--prefix=/usr";
-		push @opts, "--sysconfdir=/etc";
-		push @opts, "--localstatedir=/var";
-	}
+	my $prefix=get_buildprefix();
+	push @opts, "--prefix=$prefix";
 	push @opts, "--includedir=\${prefix}/include";
 	push @opts, "--mandir=\${prefix}/share/man";
 	push @opts, "--infodir=\${prefix}/share/info";
+	if ($prefix eq "/usr") {
+		push @opts, "--sysconfdir=/etc";
+		push @opts, "--localstatedir=/var";
+	} else {
+		push @opts, "--sysconfdir=\${prefix}/etc";
+		push @opts, "--localstatedir=\${prefix}/var";
+	}
 	if (defined $ENV{DH_VERBOSE} && $ENV{DH_VERBOSE} ne "") {
 		push @opts, "--disable-silent-rules";
 	}
diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm
index 6539e44..3d80e3c 100644
--- a/Debian/Debhelper/Buildsystem/cmake.pm
+++ b/Debian/Debhelper/Buildsystem/cmake.pm
@@ -7,7 +7,7 @@
 package Debian::Debhelper::Buildsystem::cmake;
 
 use strict;
-use Debian::Debhelper::Dh_Lib qw(compat get_buildprofile package_eos_app_id);
+use Debian::Debhelper::Dh_Lib qw(compat get_buildprefix);
 use base 'Debian::Debhelper::Buildsystem::makefile';
 
 sub DESCRIPTION {
@@ -39,21 +39,16 @@ sub new {
 sub configure {
 	my $this=shift;
 	my @flags;
+	my $prefix=get_buildprefix();
 
 	# Standard set of cmake flags
-	if (get_buildprofile("eos-app")) {
-		# Get package app id for prefix
-		my $app_prefix = package_eos_app_id();
-		push @flags, "-DCMAKE_INSTALL_PREFIX=/endless/" . $app_prefix;
-
+	push @flags, "-DCMAKE_INSTALL_PREFIX=$prefix";
+	push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON";
+	push @flags, "-DCMAKE_BUILD_TYPE=None";
+	if ($prefix ne "/usr") {
 		# Always include the RPATH from the app link paths.
 		push @flags, "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON";
 	}
-	else {
-		push @flags, "-DCMAKE_INSTALL_PREFIX=/usr";
-	}
-	push @flags, "-DCMAKE_VERBOSE_MAKEFILE=ON";
-	push @flags, "-DCMAKE_BUILD_TYPE=None";
 
 	# CMake doesn't respect CPPFLAGS, see #653916.
 	if ($ENV{CPPFLAGS} && ! compat(8)) {
diff --git a/Debian/Debhelper/Buildsystem/python_distutils.pm b/Debian/Debhelper/Buildsystem/python_distutils.pm
index fb62e87..d557802 100644
--- a/Debian/Debhelper/Buildsystem/python_distutils.pm
+++ b/Debian/Debhelper/Buildsystem/python_distutils.pm
@@ -9,7 +9,7 @@ package Debian::Debhelper::Buildsystem::python_distutils;
 
 use strict;
 use Cwd ();
-use Debian::Debhelper::Dh_Lib qw(error get_buildprofile package_eos_app_id);
+use Debian::Debhelper::Dh_Lib qw(error get_buildprefix);
 use base 'Debian::Debhelper::Buildsystem';
 
 sub DESCRIPTION {
@@ -185,18 +185,15 @@ sub build {
 sub install {
 	my $this=shift;
 	my $destdir=shift;
-	my @prefix_opt;
-	if (get_buildprofile("eos-app")) {
-		# Build with the app id of the main package by default
-		my $app_prefix=package_eos_app_id();
-		push @prefix_opt, "--prefix=/endless/" . $app_prefix;
-	}
+	my @flags;
+	my $prefix=get_buildprefix();
+	push @flags, "--prefix=$prefix" if $prefix ne "/usr";
 	$this->setup_py("install",
 		"--force",
 		"--root=$destdir",
 		"--no-compile",
 		"-O0",
-		@prefix_opt,
+		@flags,
 		@_);
 }
 
diff --git a/Debian/Debhelper/Buildsystem/qmake.pm b/Debian/Debhelper/Buildsystem/qmake.pm
index eeac47d..abf8a53 100644
--- a/Debian/Debhelper/Buildsystem/qmake.pm
+++ b/Debian/Debhelper/Buildsystem/qmake.pm
@@ -8,7 +8,7 @@ package Debian::Debhelper::Buildsystem::qmake;
 
 use strict;
 use warnings;
-use Debian::Debhelper::Dh_Lib qw(error get_buildprofile package_eos_app_id);
+use Debian::Debhelper::Dh_Lib qw(error get_buildprefix);
 use base 'Debian::Debhelper::Buildsystem::makefile';
 
 our $qmake="qmake";
@@ -66,14 +66,7 @@ sub configure {
 		push @flags, "QMAKE_LFLAGS_DEBUG=$ENV{LDFLAGS}";
 	}
 	push @flags, "QMAKE_STRIP=:";
-	if (get_buildprofile("eos-app")) {
-		# Build with the app id of the main package by default
-		my $app_prefix=package_eos_app_id();
-		push @flags, "PREFIX=/endless/" . $app_prefix;
-	}
-	else {
-		push @flags, "PREFIX=/usr";
-	}
+	push @flags, "PREFIX=" . get_buildprefix();
 
 	$this->doit_in_builddir($qmake, @options, @flags, @_);
 }
diff --git a/dh_install b/dh_install
index 66449ea..2fc1c0c 100755
--- a/dh_install
+++ b/dh_install
@@ -155,28 +155,23 @@ foreach my $package (getpackages()) {
 	foreach my $set (@install) {
 		my $dest;
 		my $tmpdest=0;
-		my $prefix;
-
-		if (get_buildprofile("eos-app")) {
-			# Get the app prefix with the leading / stripped.
-			$prefix="endless/" . package_eos_app_id($package);
-		}
+		my $prefix=substr get_buildprefix($package), 1;
 
 		if (! defined $dh{AUTODEST} && @$set > 1) {
 			$dest=pop @$set;
 
 			# Adjust the destination if app prefix is set.
-			$dest=~s,^/*usr(/|$),${prefix}$1, if defined $prefix;
-			$dest=~s,^/*etc(/|$),${prefix}/etc$1, if defined $prefix;
-			$dest=~s,^/*var(/|$),${prefix}/var$1, if defined $prefix;
+			$dest=~s,^/*usr(/|$),${prefix}$1, if $prefix ne "usr";
+			$dest=~s,^/*etc(/|$),${prefix}/etc$1, if $prefix ne "usr";
+			$dest=~s,^/*var(/|$),${prefix}/var$1, if $prefix ne "usr";
 		}
 
 		my @filelist;
 		foreach my $glob (@$set) {
 			# Adjust the glob if app prefix is set.
-			$glob=~s,^/*usr(/|$),${prefix}$1, if defined $prefix;
-			$glob=~s,^/*etc(/|$),${prefix}/etc$1, if defined $prefix;
-			$glob=~s,^/*var(/|$),${prefix}/var$1, if defined $prefix;
+			$glob=~s,^/*usr(/|$),${prefix}$1, if $prefix ne "usr";
+			$glob=~s,^/*etc(/|$),${prefix}/etc$1, if $prefix ne "usr";
+			$glob=~s,^/*var(/|$),${prefix}/var$1, if $prefix ne "usr";
 
 			my @found = glob "$srcdir/$glob";
 			if (! compat(6)) {
diff --git a/dh_installdirs b/dh_installdirs
index eace5b5..151a28e 100755
--- a/dh_installdirs
+++ b/dh_installdirs
@@ -72,10 +72,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	}	
 
 	if (@dirs) {
-		# Adjust the directories for eos-app profiles.
-		if (get_buildprofile("eos-app")) {
-			my $prefix="endless/" . package_eos_app_id($package);
-
+		# Adjust the directories for non-/usr installs.
+		my $prefix=substr get_buildprefix($package), 1;
+		if ($prefix ne "usr") {
 			@dirs=map {
 				s,^/*usr(/|$),${prefix}$1,;
 				s,^/*etc(/|$),${prefix}/etc$1,;

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