Source: file Version: 1:5.28-4 Tags: patch User: [email protected] Usertags: rebootstrap
file fails to cross build from source, because its python-all dependency selects the host architecture python, which can neither be installed nor executed. As is typical in such situations, I looked into annotating it with :any. I quickly noticed though that python is not actually used during an arch-dep build. Only the indep packages need python. Thus the real solution seems to be to move the python dependencies to Build-Depends-Indep. Once python is removed from plain Build-Depends, I see no need for a stage1 profile anymore. Rather than build file dpkg-buildpackage --build-profiles=stage1, one can simply do use dpkg-buildpackage --build=any. For this reason, the attached patch removes the stage1 build profile. The original requesters of the profile are X-Debbugs-Cced. To avoid nasty hacks such as conditional Makefile includes, I moved the python modules over to dh --buildsystem=pybuild and hope that this is acceptable. I verified that after the patch, file builds in a variety of configurations such as arch-only, indep-only, full build, cross build. Please consider applying it after leaving some time for the original requesters to disagree. I know that it is a bit invasive, but the cleanup seemed worth the effort to me. If you disagree with particular parts, I can produce a less invasive version. This particular bug can be closed whenever all python dependencies are removed from Build-Depends (e.g. by moving them to Build-Depends-Indep). Helmut
diff --minimal -Nru file-5.28/debian/changelog file-5.28/debian/changelog --- file-5.28/debian/changelog 2016-07-23 14:51:08.000000000 +0200 +++ file-5.28/debian/changelog 2016-10-16 20:10:55.000000000 +0200 @@ -1,3 +1,11 @@ +file (1:5.28-4.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: Remove stage1 profile in favour of a proper arch/indep + split. (Closes: #-1) + + -- Helmut Grohne <[email protected]> Sat, 15 Oct 2016 23:11:35 +0200 + file (1:5.28-4) unstable; urgency=low * Ship the compiled magic file in a separate package so libmagic1 is diff --minimal -Nru file-5.28/debian/control file-5.28/debian/control --- file-5.28/debian/control 2016-07-23 14:51:08.000000000 +0200 +++ file-5.28/debian/control 2016-10-16 20:19:11.000000000 +0200 @@ -3,14 +3,14 @@ Homepage: http://www.darwinsys.com/file/ Standards-Version: 3.9.8 Build-Depends: debhelper (>= 9.20141010~), - dh-autoreconf, - dh-python, dpkg-dev (>= 1.17.14~), +Build-Depends-Arch: dh-autoreconf, + zlib1g-dev, +Build-Depends-Indep: dh-python, python-all, python-setuptools, python3-all, python3-setuptools, - zlib1g-dev, Priority: standard Section: utils @@ -81,7 +81,6 @@ Description: Recognize the type of data in a file using "magic" numbers - Python bindings This package contains the Python bindings for the libmagic file type detection library. -Build-Profiles: <!stage1> Package: python3-magic Architecture: all @@ -93,4 +92,3 @@ Description: Recognize the type of data in a file using "magic" numbers - Python 3 bindings This package contains the Python 3 bindings for the libmagic file type detection library. -Build-Profiles: <!stage1> diff --minimal -Nru file-5.28/debian/python-magic.install file-5.28/debian/python-magic.install --- file-5.28/debian/python-magic.install 1970-01-01 01:00:00.000000000 +0100 +++ file-5.28/debian/python-magic.install 2016-10-17 05:32:44.000000000 +0200 @@ -0,0 +1 @@ +usr/lib/python2* diff --minimal -Nru file-5.28/debian/python3-magic.install file-5.28/debian/python3-magic.install --- file-5.28/debian/python3-magic.install 1970-01-01 01:00:00.000000000 +0100 +++ file-5.28/debian/python3-magic.install 2016-10-17 05:32:55.000000000 +0200 @@ -0,0 +1 @@ +usr/lib/python3* diff --minimal -Nru file-5.28/debian/rules file-5.28/debian/rules --- file-5.28/debian/rules 2016-07-23 14:51:08.000000000 +0200 +++ file-5.28/debian/rules 2016-10-17 05:35:01.000000000 +0200 @@ -4,10 +4,6 @@ SHELL := sh -e -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) --include /usr/share/python/python.mk -endif - DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) @@ -21,17 +17,11 @@ # HOWMANY is the number of bytes looked at by file CFLAGS += -DHOWMANY=0x18000 -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) -PYTHON_VERSIONS=$(shell pyversions -r debian/control) -PYTHON3_VERSIONS=$(shell py3versions -r debian/control) -endif - %: -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) - dh ${@} --with autoreconf,python2,python3 -else - dh ${@} --with autoreconf -endif + dh $@ $(DH_ADDONS) +binary-arch build-arch install-arch: DH_ADDONS=--with autoreconf +binary-indep build-indep install-indep: DH_ADDONS=--with python2,python3 +binary build install: DH_ADDONS=--with autoreconf,python2,python3 override_dh_auto_clean: dh_auto_clean @@ -40,27 +30,18 @@ rm -rf python/__pycache__ rm -f python/*.pyc -override_dh_auto_build: - dh_auto_build - -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) - for python in $(PYTHON_VERSIONS); \ - do \ - (cd python && $$python setup.py build_ext \ - -L$(CURDIR)/src/.libs); \ - done - - for python in $(PYTHON3_VERSIONS); \ - do \ - (cd python && $$python setup.py build_ext \ - -L$(CURDIR)/src/.libs); \ - done -endif +override_dh_auto_configure-indep: + dh_auto_configure --buildsystem=pybuild --sourcedirectory=python +override_dh_auto_build-indep: + dh_auto_build --buildsystem=pybuild --sourcedirectory=python +override_dh_auto_test-indep: +override_dh_auto_install-indep: + dh_auto_install --buildsystem=pybuild --sourcedirectory=python -override_dh_auto_configure: +override_dh_auto_configure-arch: dh_auto_configure -- $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 --enable-static --disable-silent-rules CFLAGS="$(CFLAGS)" -override_dh_auto_install: +override_dh_auto_install-arch: dh_auto_install mv debian/tmp/usr/share/misc debian/tmp/usr/share/file @@ -68,20 +49,6 @@ install -D -m 0644 magic/magic.local debian/tmp/etc/magic install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) - for python in $(PYTHON_VERSIONS); \ - do \ - (cd python && $$python setup.py install --no-compile \ - --root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \ - done - - for python in $(PYTHON3_VERSIONS); \ - do \ - (cd python && $$python setup.py install --no-compile \ - --root=$(CURDIR)/debian/python3-magic $(py_setup_install_args)); \ - done -endif - # Install additional headers mkdir -p debian/libmagic-dev/usr/include/file cp src/file.h debian/libmagic-dev/usr/include/file

