Bug#1026041: h5py: reduce Build-Depends

Helmut Grohne helmut at subdivi.de
Tue Dec 13 16:51:43 GMT 2022


Source: h5py
Version: 3.7.0-3
Tags: patch
User: debian-cross at lists.debian.org
Usertags: cross-satisfiability

h5py has lots of Build-Depends of which quite many pose issues to cross
compilation. It turns out that a fair number of them are easily
droppable. A first observation is that the documentation is already
split to an Arch:all -doc package and sphinx is only run during an
binary-indep build. Moving all of the sphinx dependencies to B-D-I means
that they become irrelevant to cross building. Only the clean target
needd a small modification to make that work. In a similar vein,
<!nocheck> annotated dependencies become irrelevant to cross building
and that turns out to work for pytest. Another issue is python3-all-dev.
It has to be rewritten as python3-all-dev:any + libpython3-all-dev. I'm
attaching a patch for your convenience. I couldn't resist also replacing
hard coded pkg-config calls and hope this is acceptable as well.

Helmut
-------------- next part --------------
diff --minimal -Nru h5py-3.7.0/debian/changelog h5py-3.7.0/debian/changelog
--- h5py-3.7.0/debian/changelog	2022-11-14 17:45:49.000000000 +0100
+++ h5py-3.7.0/debian/changelog	2022-12-13 17:44:24.000000000 +0100
@@ -1,3 +1,16 @@
+h5py (3.7.0-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Reduce Build-Depends: (Closes: #-1)
+    + Declaratively request debhelper addons.
+    + Clean docs without requiring sphinx.
+    + Move sphinx dependencies to B-D-I.
+    + Annotate pytest dependencies <!nocheck>.
+    + Multiarchify python Build-Depends.
+  * Don't hard code the build architecture pkg-config.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 13 Dec 2022 17:44:24 +0100
+
 h5py (3.7.0-3) unstable; urgency=medium
 
   * Team upload.
diff --minimal -Nru h5py-3.7.0/debian/control h5py-3.7.0/debian/control
--- h5py-3.7.0/debian/control	2022-11-14 17:45:49.000000000 +0100
+++ h5py-3.7.0/debian/control	2022-12-13 16:42:51.000000000 +0100
@@ -6,25 +6,28 @@
 Priority: optional
 Build-Depends: cython3 (>= 0.29.15),
                debhelper-compat (= 13),
-               dh-python,
+               dh-sequence-python3,
                pybuild-plugin-pyproject,
                dpkg-dev (>= 1.17.14),
                libhdf5-dev,
                libhdf5-mpi-dev (>= 1.10.6+repack-1),
-               libjs-mathjax,
                liblzf-dev,
+               libpython3-all-dev,
                mpi-default-dev,
                pkg-config,
-               python3-all-dev,
+               python3-all-dev:any,
                python3-cached-property,
                python3-mpi4py (>= 3.0.3),
                python3-numpy (>= 1.19.3),
                python3-pkgconfig,
-               python3-pytest,
-               python3-pytest-mpi,
+               python3-pytest <!nocheck>,
+               python3-pytest-mpi <!nocheck>,
                python3-setuptools,
                python3-six,
                python3-unittest2,
+Build-Depends-Indep:
+               dh-sequence-sphinxdoc <!nodoc>,
+               libjs-mathjax,
                python3-sphinx <!nodoc>
 Standards-Version: 4.6.1
 Vcs-Browser: https://salsa.debian.org/science-team/h5py
diff --minimal -Nru h5py-3.7.0/debian/rules h5py-3.7.0/debian/rules
--- h5py-3.7.0/debian/rules	2022-11-14 17:45:49.000000000 +0100
+++ h5py-3.7.0/debian/rules	2022-12-13 16:29:57.000000000 +0100
@@ -4,6 +4,7 @@
 #export DH_VERBOSE = 1
 
 include /usr/share/dpkg/buildflags.mk
+include /usr/share/dpkg/buildtools.mk
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
@@ -23,7 +24,7 @@
 export OMPI_MCA_rmaps_base_oversubscribe=1
 
 %:
-	dh $@ --with python3,sphinxdoc --buildsystem=pybuild
+	dh $@ --buildsystem=pybuild
 
 override_dh_clean:
 	dh_clean
@@ -32,10 +33,7 @@
 override_dh_auto_clean:
 	dh_auto_clean -D $(BUILD_DIR_SERIAL) || /bin/true
 	dh_auto_clean -D $(BUILD_DIR_MPI) || /bin/true
-ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
-	$(MAKE) -C docs clean
-	$(MAKE) -C docs_api clean
-endif
+	rm -Rf docs/_build docs_api/_build
 
 override_dh_auto_configure:
 	mkdir $(BUILD_DIR_SERIAL); bash -O extglob -c "cp -ra ./!($(BUILD_DIR_SERIAL)) $(BUILD_DIR_SERIAL)"
@@ -66,7 +64,7 @@
 	for DIR in $$(find .pybuild/cpython3*mpi -name build); do \
 		cp -r $(CURDIR)/debian/wrapper_module/h5py/* $$DIR/h5py/; \
 	done
-	cd $(BUILD_DIR_MPI)/lzf; $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(shell pkg-config --cflags --libs hdf5-mpi liblzf) -fPIC -shared lzf_filter.c -o liblzf_filter.so
+	cd $(BUILD_DIR_MPI)/lzf; $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(shell $(PKG_CONFIG) --cflags --libs hdf5-mpi liblzf) -fPIC -shared lzf_filter.c -o liblzf_filter.so
 
 # build serial build only for arch builds
 execute_after_dh_auto_build-arch: export http_proxy=127.0.0.1:9
@@ -76,7 +74,7 @@
 	for DIR in $$(find .pybuild/cpython3*serial -name build); do \
 		cp -r $(CURDIR)/debian/wrapper_module/h5py/* $$DIR/h5py/; \
 	done
-	cd $(BUILD_DIR_SERIAL)/lzf; $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(shell pkg-config --cflags --libs hdf5-serial liblzf) -fPIC -shared lzf_filter.c -o liblzf_filter.so
+	cd $(BUILD_DIR_SERIAL)/lzf; $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(shell $(PKG_CONFIG) --cflags --libs hdf5-serial liblzf) -fPIC -shared lzf_filter.c -o liblzf_filter.so
 
 
 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
@@ -122,8 +120,8 @@
 	rm -rf debian/python3-h5py-serial/usr/lib/python*/dist-packages/h5py/_debian_h5py_serial/tests/data_files
 	rm -rf debian/python3-h5py-mpi/usr/lib/python*/dist-packages/h5py/_debian_h5py_mpi/tests/data_files
 	dh_install -a
-	dh_install -phdf5-plugin-lzf  $(BUILD_DIR_SERIAL)/lzf/liblzf_filter.so  $(shell pkg-config --variable=PluginDir hdf5-serial)
-	dh_install -phdf5-plugin-lzf  $(BUILD_DIR_MPI)/lzf/liblzf_filter.so     $(shell pkg-config --variable=PluginDir hdf5-mpi)
+	dh_install -phdf5-plugin-lzf  $(BUILD_DIR_SERIAL)/lzf/liblzf_filter.so  $(shell $(PKG_CONFIG) --variable=PluginDir hdf5-serial)
+	dh_install -phdf5-plugin-lzf  $(BUILD_DIR_MPI)/lzf/liblzf_filter.so     $(shell $(PKG_CONFIG) --variable=PluginDir hdf5-mpi)
 
 override_dh_python3-arch:
 	PYBUILD_NAME=$(PYBUILD_NAME_SERIAL) dh_python3


More information about the debian-science-maintainers mailing list