mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +00:00
debian: Use pybuild to handle OVS Python module.
At present, the OVS Python module is built and installed after `dh_install`. This was done to ensure proper linking of the _json Python extension. A side effect of this approach is that .install files unexpectedly do not work, and consequently placement of Python executables become cumbersome and non-standard. The preferred approach to this is to make use of pybuild. In addition to solving the .install file problem, it also takes care of building extensions for every requested/supported Python version, without the need for retrieving and looping over versions in debian/rules. We still can't use fully standard Python handling, as we have interdependencies between C and Python parts of the code base to build the Python JSON extension. Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
parent
8b7f1eb8db
commit
e4193663af
1
debian/openvswitch-test.install
vendored
1
debian/openvswitch-test.install
vendored
@ -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/*
|
||||
|
8
debian/python3-openvswitch.install
vendored
8
debian/python3-openvswitch.install
vendored
@ -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
|
||||
|
41
debian/rules
vendored
41
debian/rules
vendored
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user