Package: debhelper
Version: 9.20151005
Tags: patch
Debian::Debhelper::Buildsystem::cmake::configure() contains a subtle bug
which
swallows $@ for certain error conditions.
I discovered the bug while trying to build digikam, which fails with
this error:
Died at /usr/share/perl5/Debian/Debhelper/Buildsystem/cmake.pm line 93.
debian/rules:19: recipe for target 'override_dh_auto_configure' failed
But it should die with this error:
dh_auto_configure: cmake .. -DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None
-DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var
-DCMAKE_BUILD_TYPE=Debian -DCMAKE_INSTALL_RPATH=/usr/lib/digikam
-DDIGIKAMSC_COMPILE_DOC=on -DDIGIKAMSC_COMPILE_PO=on -DENABLE_LCMS2=ON
-DKDE4_BUILD_TESTS=OFF -DDIGIKAMSC_USE_PRIVATE_KDEGRAPHICS=OFF returned
exit code 1
debian/rules:19: recipe for target 'override_dh_auto_configure' failed
The solution is simple, and included as a patch.
>From 4b42204da774cec2345e140c16a49c1ac04e37de Mon Sep 17 00:00:00 2001
From: Jonathan Hall <[email protected]>
Date: Sun, 25 Oct 2015 20:01:00 +0100
Subject: [PATCH] Don't swallow $@ when configure() fails, for accurate error
reporting.
---
Debian/Debhelper/Buildsystem/cmake.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm
index 6bd591b..882e72c 100644
--- a/Debian/Debhelper/Buildsystem/cmake.pm
+++ b/Debian/Debhelper/Buildsystem/cmake.pm
@@ -85,12 +85,12 @@ sub configure {
$this->mkdir_builddir();
eval {
$this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags, @_);
- };
- if ($@) {
+ } or do {
+ my $err = $@ || "unknown error";
if (-e $this->get_buildpath("CMakeCache.txt")) {
$this->doit_in_builddir("tail -v -n +0 CMakeCache.txt");
}
- die $@;
+ die $err;
}
}
--
2.6.1