Source: libxml2
Version: 2.9.4+dfsg1-2.2
Severity: wishlist
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

libxml2 does have an ancient stage1 build profile to be used with
bootstrapping. It is still necessary and useful for bootstrapping today.
Still it has a few shortcomings:

 * The use of DEB_BUILD_PROFILE (note the singular) predates the
   interface accepted into dpkg and debhelper and should be switched to
   DEB_BUILD_PROFILES.
 * The use of a stage1 profile is not descriptive. A few profile names
   are standardized now and nopython is one of them. Since bootstrapping
   will select profiles automatically as necessary, we should switch to
   using functional names rather than pretending that all those profiles
   are necessary for bootstrapping until eternity.
 * When a (foreign) python is installed, the profile doesn't work and it
   still tries to build the python extensions.
 * debian/control lacks build profile annotations (as its implementation
   predates build profiles) and thus the build profile cannot be
   selected by automated tools.

The attached patch fixes all of the points mentioned above. Please
consider applying it after stretch is released. If you have any
questions, don't hesitate to ask.

Helmut
diff --minimal -Nru libxml2-2.9.4+dfsg1/debian/changelog 
libxml2-2.9.4+dfsg1/debian/changelog
--- libxml2-2.9.4+dfsg1/debian/changelog        2017-01-14 15:31:49.000000000 
+0100
+++ libxml2-2.9.4+dfsg1/debian/changelog        2017-05-17 19:14:28.000000000 
+0200
@@ -1,3 +1,15 @@
+libxml2 (2.9.4+dfsg1-2.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve build profile support: (Closes: #-1)
+    + Rename stage1 to meaningful nopython.
+    + Use the standard variable DEB_BUILD_PROFILES rather than
+      DEB_BUILD_PROFILE by checking dh_listpackages.
+    + Correctly build nopython even when python is installed.
+    + Add build profile annotations to debian/control.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 17 May 2017 19:14:28 +0200
+
 libxml2 (2.9.4+dfsg1-2.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --minimal -Nru libxml2-2.9.4+dfsg1/debian/control 
libxml2-2.9.4+dfsg1/debian/control
--- libxml2-2.9.4+dfsg1/debian/control  2017-01-14 15:07:44.000000000 +0100
+++ libxml2-2.9.4+dfsg1/debian/control  2017-05-17 19:14:28.000000000 +0200
@@ -5,10 +5,10 @@
 Uploaders: Aron Xu <a...@debian.org>, YunQiang Su <wzss...@gmail.com>
 Standards-Version: 3.9.8
 Build-Depends: debhelper (>= 9), dh-autoreconf, autotools-dev, pkg-config,
- libpython-all-dev, libpython-all-dbg,
- python-all-dev:any (>= 2.7.5-5~), python-all-dbg:any,
- libpython3-all-dev, libpython3-all-dbg,
- python3-all-dev:any (>= 3.5), python3-all-dbg:any,
+ libpython-all-dev <!nopython>, libpython-all-dbg <!nopython>,
+ python-all-dev:any (>= 2.7.5-5~) <!nopython>, python-all-dbg:any <!nopython>,
+ libpython3-all-dev <!nopython>, libpython3-all-dbg <!nopython>,
+ python3-all-dev:any (>= 3.5) <!nopython>, python3-all-dbg:any <!nopython>,
  zlib1g-dev | libz-dev, liblzma-dev, libicu-dev
 Homepage: http://xmlsoft.org/
 Vcs-Git: git://anonscm.debian.org/debian-xml-sgml/libxml2.git
@@ -117,6 +117,7 @@
 
 Package: python-libxml2
 Architecture: any
+Build-Profiles: <!nopython>
 Section: python
 Provides: ${python:Provides}
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}
@@ -133,6 +134,7 @@
 
 Package: python-libxml2-dbg
 Architecture: any
+Build-Profiles: <!nopython>
 Section: debug
 Priority: extra
 Provides: ${python:Provides}
@@ -150,6 +152,7 @@
 
 Package: python3-libxml2
 Architecture: any
+Build-Profiles: <!nopython>
 Section: python
 Multi-Arch: same
 Provides: ${python3:Provides}
@@ -167,6 +170,7 @@
 
 Package: python3-libxml2-dbg
 Architecture: any
+Build-Profiles: <!nopython>
 Section: debug
 Priority: extra
 Multi-Arch: same
diff --minimal -Nru libxml2-2.9.4+dfsg1/debian/rules 
libxml2-2.9.4+dfsg1/debian/rules
--- libxml2-2.9.4+dfsg1/debian/rules    2017-01-14 15:07:44.000000000 +0100
+++ libxml2-2.9.4+dfsg1/debian/rules    2017-05-17 19:14:28.000000000 +0200
@@ -1,12 +1,26 @@
 #!/usr/bin/make -f
 export DH_VERBOSE=1
 
+DOPACKAGES = $(shell dh_listpackages)
+
+ifneq (,$(filter python-libxml2 python-libxml2-dbg,$(DOPACKAGES)))
 # The versions of python currently supported
 PYVERS=$(shell pyversions -s)
-PY3VERS=$(shell py3versions -s)
 # The current default version of python
 PYVER=$(shell pyversions -d)
+else
+PYVERS=
+PYVER=
+endif
+ifneq (,$(filter python3-libxml2 python3-libxml2-dbg,$(DOPACKAGES)))
+# The versions of python3 currently supported
+PY3VERS=$(shell py3versions -s)
+# The current default version of python3
 PY3VER=$(shell py3versions -d)
+else
+PY3VERS=
+PY3VER=
+endif
 
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
@@ -29,11 +43,6 @@
 export DH_OPTIONS = -Nlibxml2-udeb
 endif
 
-ifeq ($(DEB_BUILD_PROFILE),stage1)
-DH_OPTIONS += -Npython-libxml2 -Npython-libxml2-dbg -Npython3-libxml2 
-Npython3-libxml2-dbg
-export DH_OPTIONS
-endif
-
 CONFIGURE_FLAGS := --disable-silent-rules --with-history CC="$(CC)" 
CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 
--cache-file="$(CURDIR)/builddir/config.cache"
 
 override_dh_auto_configure: $(TARGETS:%=doconfigure-%)
@@ -123,8 +132,10 @@
 
 override_dh_install-arch:
        dh_install -Npython-libxml2-dbg -Npython3-libxml2-dbg -Nlibxml2-udeb
-ifneq ($(DEB_BUILD_PROFILE),stage1)
+ifneq (,$(filter python-libxml2-dbg,$(DOPACKAGES)))
        dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
+endif
+ifneq (,$(filter python3-libxml2-dbg,$(DOPACKAGES)))
        dh_install -ppython3-libxml2-dbg --sourcedir=debian/tmp-dbg
 endif
        dh_install -plibxml2-udeb --sourcedir=debian/tmp-udeb
@@ -133,8 +144,10 @@
 override_dh_strip:
        dh_strip -a --dbg-package=libxml2-dbg -Nlibxml2-udeb -Nlibxml2-utils 
-Nlibxml2-utils-dbg -Npython-libxml2 -Npython-libxml2-dbg -Npython3-libxml2 
-Npython3-libxml2-dbg
        dh_strip -plibxml2-utils --dbg-package=libxml2-utils-dbg
-ifneq ($(DEB_BUILD_PROFILE),stage1)
+ifneq (,$(filter python-libxml2 python-libxml2-dbg,$(DOPACKAGES)))
        dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
+endif
+ifneq (,$(filter python3-libxml2 python3-libxml2-dbg,$(DOPACKAGES)))
        dh_strip -ppython3-libxml2 --dbg-package=python3-libxml2-dbg
 endif
        $(foreach python, $(filter-out $(PYVER), $(PYVERS)),\
@@ -158,8 +171,8 @@
        dh_gencontrol -- -Vdep:libicudbg="`dpkg-query -f '$${Depends}' -W 
libicu-dev | sed 's/.*\(libicu[0-9]*\).*/\1/'`-dbg"
 
 %:
-ifeq ($(DEB_BUILD_PROFILE),stage1)
-       dh $@ --with autoreconf
-else
-       dh $@ --parallel --with autoreconf,python2,python3
-endif
+       dh $@ \
+               --parallel \
+               --with autoreconf \
+               $(if $(filter python-libxml2 
python-libxml2-dbg,$(DOPACKAGES)),--with python2) \
+               $(if $(filter python3-libxml2 
python3-libxml2-dbg,$(DOPACKAGES)),--with python3)

Reply via email to