Bug#853017: bitlbee: FTBFS on every autobuilder: dh_testroot: You must run this as root (or use fakeroot).

2017-01-28 Thread Wilmer van der Gaast
Yeah already preparing a fix. Turns out the fix from 3.4-1.1 was a
different fix from the one posted by the NMU'er on the bug. :-(



Bug#853017: bitlbee: FTBFS on every autobuilder: dh_testroot: You must run this as root (or use fakeroot).

2017-01-28 Thread Santiago Vila
Package: src:bitlbee
Version: 3.5-1.1
Severity: serious
Tags: patch

Dear maintainer:

I tried to build this package with "dpkg-buildpackage -A"
but it failed:


[...]
 debian/rules build-indep
dh_testdir
mkdir -p debian/build-native
ROOT=$PWD; cd debian/build-native; BITLBEE_VERSION="3.5-1.1" 
CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2" CFLAGS="-g -O2 
-fdebug-prefix-map=/<>=. -fstack-protector-strong -Wformat 
-Werror=format-security" LDFLAGS="-Wl,-z,relro" $ROOT/configure --debug=0 
--prefix=/usr --etcdir=/etc/bitlbee --events=libevent --otr=plugin --skype=0 
BitlBee configure

configure script run from a different directory. Will create some symlinks...
Spoofing version number: 3.5-1.1

Architecture: Linux

Configuration done:
  Debugging disabled.
  AddressSanitizer (ASAN) disabled.

[... snipped ...]

/usr/bin/make -C doc/user-guide
make[1]: Entering directory '/<>/doc/user-guide'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/<>/doc/user-guide'
touch build-stamp
dh_testdir
dh_testroot
dh_testroot: You must run this as root (or use fakeroot).
debian/rules:77: recipe for target 'install' failed
make: *** [install] Error 255
dpkg-buildpackage: error: debian/rules build-indep gave error exit status 2


This happens because the build-* targets depend on their binary-* counterparts,
but this should never be the case, because they are invoked as a normal user by
either "dpkg-buildpackage -A" or "dpkg-buildpackage -B", so we are not root yet
to execute the binary-targets.

Suggested fix: There was already a working build target, just make the two
additional build-* targets to depend on it.

Trivial (but untested) patch follows. Please ensure that the package is 
buildable
with both "dpkg-buildpackage -A" and "dpkg-buildpackage -B" before uploading 
again.

Thanks.

--- a/debian/rules
+++ b/debian/rules
@@ -41,8 +41,8 @@ CONFIGURE_OVERRIDES:=CPPFLAGS="$(CPPFLAGS)" 
CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAG
 
 HAS_DH_SYSTEMD:=$(shell dpkg-query -W -f='$${Status}' dh-systemd 2>/dev/null | 
grep -c "ok installed")
 # https://bugs.debian.org/821967
-build-indep: binary-indep
-build-arch: binary-arch
+build-indep: build
+build-arch: build
 
 build: build-stamp
 build-stamp: