[debhelper-devel] [debhelper] 03/04: qmake: Gracefully error out on missing OS_MKSPEC_MAPPING

Niels Thykier nthykier at moszumanska.debian.org
Sun Oct 1 20:26:35 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 7b4efaca33d046236182dad03e9e729ac01567c3
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Oct 1 20:23:23 2017 +0000

    qmake: Gracefully error out on missing OS_MKSPEC_MAPPING
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 lib/Debian/Debhelper/Buildsystem/qmake.pm | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/Debian/Debhelper/Buildsystem/qmake.pm b/lib/Debian/Debhelper/Buildsystem/qmake.pm
index e22d07d..21be26c 100644
--- a/lib/Debian/Debhelper/Buildsystem/qmake.pm
+++ b/lib/Debian/Debhelper/Buildsystem/qmake.pm
@@ -14,6 +14,12 @@ use parent qw(Debian::Debhelper::Buildsystem::makefile);
 
 our $qmake="qmake";
 
+my %OS_MKSPEC_MAPPING = (
+	'linux'    => 'linux-g++',
+	'kfreebsd' => 'gnukfreebsd-g++',
+	'hurd'     => 'hurd-g++',
+);
+
 sub DESCRIPTION {
 	"qmake (*.pro)";
 }
@@ -55,12 +61,12 @@ sub configure {
 	push @options, '-nocache';
 	if (is_cross_compiling()) {
 		my $host_os = dpkg_architecture_value("DEB_HOST_ARCH_OS");
-		my %os_mkspec_mapping = (
-			'linux'    => 'linux-g++',
-			'kfreebsd' => 'gnukfreebsd-g++',
-			'hurd'     => 'hurd-g++',
-		);
-		push @options, ("-spec", $os_mkspec_mapping{$host_os});
+
+		if (defined(my $spec = $OS_MKSPEC_MAPPING{$host_os})) {
+			push(@options, ("-spec", $OS_MKSPEC_MAPPING{$host_os}));
+		} else {
+			error("Cannot cross-compile: Missing entry for HOST OS ${host_os} for qmake's -spec option");
+		}
 
 		my ($fh, $filename) = tempfile("qt.XXXX", SUFFIX => ".conf", TMPDIR => 1, UNLINK => 1);
 		$fh->print("[Paths]\n");

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