diff --git a/debian/openvswitch-test.install b/debian/openvswitch-test.install index 88c825280..dfc8ebf30 100644 --- a/debian/openvswitch-test.install +++ b/debian/openvswitch-test.install @@ -2,4 +2,5 @@ usr/bin/ovs-l3ping usr/bin/ovs-test usr/share/man/man8/ovs-l3ping.8 usr/share/man/man8/ovs-test.8 +usr/share/openvswitch/python/ovstest usr/lib/python3/dist-packages/ usr/share/openvswitch/scripts/usdt/* diff --git a/debian/python3-openvswitch.install b/debian/python3-openvswitch.install index e1e8c3a6e..0c1b34351 100644 --- a/debian/python3-openvswitch.install +++ b/debian/python3-openvswitch.install @@ -1 +1,9 @@ +# At the dh_install stage we need to retain python version specific directory +# tree to support extensions. +# +# dh_python will consolidate into usr/lib/python3/dist-packages retaining +# version specific shared object files. +usr/lib/python3* usr/lib/ + +usr/bin/ovs-flowviz usr/share/man/man8/ovs-flowviz.8 diff --git a/debian/rules b/debian/rules index b6f905f3c..2b5629e53 100755 --- a/debian/rules +++ b/debian/rules @@ -16,7 +16,6 @@ else PARALLEL = endif -PYTHON3S:=$(shell py3versions -vr) DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH) override_dh_auto_configure: @@ -80,9 +79,26 @@ endif # nodpdk endif # i386/amd64/ppc64el endif # nocheck +export PYBUILD_DESTDIR = $(CURDIR)/debian/tmp +export PYBUILD_DIR = $(CURDIR)/python + +pybuild = \ + export PKG_CONFIG_PATH=$(CURDIR)/debian/tmp/usr/lib/pkgconfig; \ + export PKG_CONFIG_SYSROOT_DIR=$(CURDIR)/debian/tmp; \ + export PKG_CONFIG_SYSTEM_INCLUDE_PATH=/; \ + export PKG_CONFIG_SYSTEM_LIBRARY_PATH=/; \ + enable_shared=no \ + extra_cflags="`pkg-config --cflags libopenvswitch`" \ + extra_libs="-Wl,-Bstatic -lopenvswitch -Wl,-Bdynamic `pkg-config --libs --static libopenvswitch`" \ + pybuild + override_dh_auto_build: dh_auto_build --sourcedirectory=_debian -- dist distdir=openvswitch dh_auto_build --sourcedirectory=_debian + # We need an extra install here so that we can use pkgconfig to + # retrieve accurate CFLAGS and LDFLAGS for building Python extensions. + dh_auto_install --sourcedirectory=_debian + $(pybuild) --build ifneq (,$(filter i386 amd64 ppc64el arm64, $(DEB_HOST_ARCH))) ifeq (,$(filter nodpdk, $(DEB_BUILD_OPTIONS))) dh_auto_build --sourcedirectory=_dpdk @@ -91,28 +107,15 @@ endif execute_before_dh_auto_clean: find . -name "*.pyc" -delete + if test -d $(PYBUILD_DIR)/build; then \ + pybuild --clean ; \ + fi override_dh_auto_install: + # We need to use pybuild to install Python extensions. + $(pybuild) --install dh_auto_install --sourcedirectory=_debian -execute_after_dh_install: - set -e && for pyvers in $(PYTHON3S); do \ - cd python; \ - export PKG_CONFIG_PATH=$(CURDIR)/debian/tmp/usr/lib/pkgconfig; \ - export PKG_CONFIG_SYSROOT_DIR=$(CURDIR)/debian/tmp; \ - export PKG_CONFIG_SYSTEM_INCLUDE_PATH=/; \ - export PKG_CONFIG_SYSTEM_LIBRARY_PATH=/; \ - enable_shared=no \ - extra_cflags="`pkg-config --cflags libopenvswitch`" \ - extra_libs="-Wl,-Bstatic -lopenvswitch -Wl,-Bdynamic `pkg-config --libs --static libopenvswitch`" \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python3-openvswitch; \ - cd ..; \ - mkdir -p $(CURDIR)/debian/openvswitch-test/usr/lib/python$$pyvers/dist-packages/ovstest; \ - install -v -D python/ovstest/*.py \ - $(CURDIR)/debian/openvswitch-test/usr/lib/python$$pyvers/dist-packages/ovstest; \ - done - override_dh_installinit: dh_installinit --restart-after-upgrade dh_installinit -popenvswitch-switch --name=ovsdb-server --no-start