2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 05:47:55 +00:00

debian: Add option to build without DPDK.

Co-authored-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Ilya Maximets 2022-07-14 17:55:46 +02:00
parent c78e7efa7b
commit 16bec677aa
9 changed files with 135 additions and 64 deletions

View File

@ -204,9 +204,10 @@ function build_ovs()
} }
if [ "$DEB_PACKAGE" ]; then if [ "$DEB_PACKAGE" ]; then
./boot.sh && ./configure --with-dpdk=$DPDK && make debian
mk-build-deps --install --root-cmd sudo --remove debian/control mk-build-deps --install --root-cmd sudo --remove debian/control
dpkg-checkbuilddeps dpkg-checkbuilddeps
DEB_BUILD_OPTIONS='parallel=4 nocheck' fakeroot debian/rules binary make debian-deb
packages=$(ls $(pwd)/../*.deb) packages=$(ls $(pwd)/../*.deb)
deps="" deps=""
for pkg in $packages; do for pkg in $packages; do

View File

@ -216,11 +216,19 @@ jobs:
deb_dependencies: | deb_dependencies: |
linux-headers-$(uname -r) build-essential fakeroot devscripts equivs linux-headers-$(uname -r) build-essential fakeroot devscripts equivs
DEB_PACKAGE: yes DEB_PACKAGE: yes
DPDK: ${{ matrix.dpdk }}
name: linux deb name: linux deb ${{ matrix.dpdk }} dpdk
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 30 timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- dpdk: no
- dpdk: shared
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -234,6 +242,9 @@ jobs:
run: sudo apt update || true run: sudo apt update || true
- name: install dependencies for debian packages - name: install dependencies for debian packages
run: sudo apt install -y ${{ env.deb_dependencies }} run: sudo apt install -y ${{ env.deb_dependencies }}
- name: install dpdk-dev
if: matrix.dpdk != 'no'
run: sudo apt install -y libdpdk-dev
- name: prepare - name: prepare
run: ./.ci/linux-prepare.sh run: ./.ci/linux-prepare.sh
@ -244,5 +255,5 @@ jobs:
- name: upload deb packages - name: upload deb packages
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: deb-packages name: deb-packages-${{ matrix.dpdk }}-dpdk
path: '/home/runner/work/ovs/*.deb' path: '/home/runner/work/ovs/*.deb'

1
.gitignore vendored
View File

@ -68,6 +68,7 @@ TAGS
cscope.* cscope.*
tags tags
_debian _debian
_dpdk
odp-netlink.h odp-netlink.h
odp-netlink-macros.h odp-netlink-macros.h
OvsDpInterface.h OvsDpInterface.h

View File

@ -58,38 +58,28 @@ You do not need to be the superuser to build the Debian packages.
top level directory. top level directory.
3. Install the build dependencies listed under "Build-Depends:" near the top of 3. Install the build dependencies listed under "Build-Depends:" near the top of
``debian/control``. You can install these any way you like, e.g. with ``debian/control.in``. You can install these any way you like, e.g. with
``apt-get install``. ``apt-get install``.
4. Prepare the package source.
If you want to build the package with DPDK support execute the following
command::
$ ./boot.sh && ./configure --with-dpdk=shared && make debian
If not::
$ ./boot.sh && ./configure && make debian
Check your work by running ``dpkg-checkbuilddeps`` in the top level of your OVS Check your work by running ``dpkg-checkbuilddeps`` in the top level of your OVS
directory. If you've installed all the dependencies properly, directory. If you've installed all the dependencies properly,
``dpkg-checkbuilddeps`` will exit without printing anything. If you forgot to ``dpkg-checkbuilddeps`` will exit without printing anything. If you forgot to
install some dependencies, it will tell you which ones. install some dependencies, it will tell you which ones.
4. Build the package:: 5. Build the package::
$ fakeroot debian/rules binary $ make debian-deb
This will do a serial build that runs the unit tests. This will take
approximately 8 to 10 minutes. If you prefer, you can run a faster parallel
build::
$ DEB_BUILD_OPTIONS='parallel=8' fakeroot debian/rules binary
If you are in a big hurry, you can even skip the unit tests::
$ DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
.. note::
There are a few pitfalls in the Debian packaging building system so that,
occasionally, you may find that in a tree that you have using for a while,
the build command above exits immediately without actually building anything.
To fix the problem, run::
$ fakeroot debian/rules clean
or start over from a fresh copy of the source tree.
5. The generated .deb files will be in the parent directory of the Open vSwitch 5. The generated .deb files will be in the parent directory of the Open vSwitch
source distribution. source distribution.

21
debian/.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
*.debhelper
*.debhelper.log
*.substvars
/autoreconf.after
/autoreconf.before
/control
/copyright
/debhelper-build-stamp
/files
/openvswitch-common
/openvswitch-doc
/openvswitch-ipsec
/openvswitch-pki
/openvswitch-source
/openvswitch-switch
/openvswitch-switch-dpdk
/openvswitch-test
/openvswitch-testcontroller
/openvswitch-vtep
/python3-openvswitch
/tmp

51
debian/automake.mk vendored
View File

@ -2,8 +2,7 @@ EXTRA_DIST += \
debian/README.Debian \ debian/README.Debian \
debian/changelog \ debian/changelog \
debian/clean \ debian/clean \
debian/control \ debian/control.in \
debian/copyright \
debian/copyright.in \ debian/copyright.in \
debian/dirs \ debian/dirs \
debian/gbp.conf \ debian/gbp.conf \
@ -80,12 +79,54 @@ check-debian-changelog-version:
ALL_LOCAL += check-debian-changelog-version ALL_LOCAL += check-debian-changelog-version
DIST_HOOKS += check-debian-changelog-version DIST_HOOKS += check-debian-changelog-version
$(srcdir)/debian/copyright: AUTHORS.rst debian/copyright.in
update_deb_copyright = \
$(AM_V_GEN) \ $(AM_V_GEN) \
{ sed -n -e '/%AUTHORS%/q' -e p < $(srcdir)/debian/copyright.in; \ { sed -n -e '/%AUTHORS%/q' -e p < $(srcdir)/debian/copyright.in; \
tail -n +28 $(srcdir)/AUTHORS.rst | sed '1,/^$$/d' | \ tail -n +28 $(srcdir)/AUTHORS.rst | sed '1,/^$$/d' | \
sed -n -e '/^$$/q' -e 's/^/ /p'; \ sed -n -e '/^$$/q' -e 's/^/ /p'; \
sed -e '1,/%AUTHORS%/d' $(srcdir)/debian/copyright.in; \ sed -e '1,/%AUTHORS%/d' $(srcdir)/debian/copyright.in; \
} > $@ } > debian/copyright
DISTCLEANFILES += debian/copyright debian/copyright: AUTHORS.rst debian/copyright.in
$(update_deb_copyright)
CLEANFILES += debian/copyright
if DPDK_NETDEV
update_deb_control = \
$(AM_V_GEN) sed -e 's/^\# DPDK_NETDEV //' \
< $(srcdir)/debian/control.in > debian/control
else
update_deb_control = \
$(AM_V_GEN) grep -v '^\# DPDK_NETDEV' \
< $(srcdir)/debian/control.in > debian/control
endif
debian/control: $(srcdir)/debian/control.in Makefile
$(update_deb_control)
CLEANFILES += debian/control
debian: debian/copyright debian/control
.PHONY: debian
debian-deb: debian
@if test X"$(srcdir)" != X"$(top_builddir)"; then \
echo "Debian packages should be built from $(abs_srcdir)/"; \
exit 1; \
fi
$(MAKE) distclean
$(update_deb_copyright)
$(update_deb_control)
$(AM_V_GEN) fakeroot debian/rules clean
if DPDK_NETDEV
$(AM_V_GEN) DEB_BUILD_OPTIONS="nocheck parallel=`nproc`" \
fakeroot debian/rules binary
else
$(AM_V_GEN) DEB_BUILD_OPTIONS="nocheck parallel=`nproc` nodpdk" \
fakeroot debian/rules binary
endif

4
debian/clean vendored
View File

@ -1,2 +1,2 @@
_debian _debian/
_dpdk _dpdk/

View File

@ -12,7 +12,7 @@ Build-Depends:
autoconf (>= 2.64), autoconf (>= 2.64),
automake (>= 1.10), automake (>= 1.10),
bzip2, bzip2,
debhelper-compat (= 13), debhelper-compat (= 10),
dh-exec, dh-exec,
dh-python, dh-python,
dh-sequence-python3, dh-sequence-python3,
@ -21,7 +21,7 @@ Build-Depends:
iproute2, iproute2,
libcap-ng-dev, libcap-ng-dev,
libdbus-1-dev [amd64 i386 ppc64el arm64], libdbus-1-dev [amd64 i386 ppc64el arm64],
libdpdk-dev (>= 21.11) [amd64 i386 ppc64el arm64], # DPDK_NETDEV libdpdk-dev (>= 21.11) [amd64 i386 ppc64el arm64],
libnuma-dev [amd64 i386 ppc64el arm64], libnuma-dev [amd64 i386 ppc64el arm64],
libpcap-dev [amd64 i386 ppc64el arm64], libpcap-dev [amd64 i386 ppc64el arm64],
libssl-dev, libssl-dev,
@ -176,34 +176,34 @@ Description: Open vSwitch switch implementations
openvswitch-switch provides the userspace components and utilities for openvswitch-switch provides the userspace components and utilities for
the Open vSwitch kernel-based switch. the Open vSwitch kernel-based switch.
Package: openvswitch-switch-dpdk # DPDK_NETDEV Package: openvswitch-switch-dpdk
Architecture: amd64 arm64 i386 ppc64el # DPDK_NETDEV Architecture: amd64 arm64 i386 ppc64el
Pre-Depends: ${misc:Pre-Depends}, # DPDK_NETDEV Pre-Depends: ${misc:Pre-Depends},
Depends: # DPDK_NETDEV Depends:
dpdk, # DPDK_NETDEV dpdk,
openvswitch-switch (= ${binary:Version}), # DPDK_NETDEV openvswitch-switch (= ${binary:Version}),
${misc:Depends}, # DPDK_NETDEV ${misc:Depends},
${python3:Depends}, # DPDK_NETDEV ${python3:Depends},
${shlibs:Depends}, # DPDK_NETDEV ${shlibs:Depends},
Enhances: # DPDK_NETDEV Enhances:
openvswitch-switch, # DPDK_NETDEV openvswitch-switch,
Description: DPDK enabled Open vSwitch switch implementation # DPDK_NETDEV Description: DPDK enabled Open vSwitch switch implementation
Open vSwitch is a production quality, multilayer, software-based, # DPDK_NETDEV Open vSwitch is a production quality, multilayer, software-based,
Ethernet virtual switch. It is designed to enable massive network # DPDK_NETDEV Ethernet virtual switch. It is designed to enable massive network
automation through programmatic extension, while still supporting # DPDK_NETDEV automation through programmatic extension, while still supporting
standard management interfaces and protocols (e.g. NetFlow, IPFIX, # DPDK_NETDEV standard management interfaces and protocols (e.g. NetFlow, IPFIX,
sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In addition, it is designed # DPDK_NETDEV sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In addition, it is designed
to support distribution across multiple physical servers similar to # DPDK_NETDEV to support distribution across multiple physical servers similar to
VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V. # DPDK_NETDEV VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
. # DPDK_NETDEV .
openvswitch-switch provides the userspace components and utilities for # DPDK_NETDEV openvswitch-switch provides the userspace components and utilities for
the Open vSwitch kernel-based switch. # DPDK_NETDEV the Open vSwitch kernel-based switch.
. # DPDK_NETDEV .
DPDK is a set of libraries for fast packet processing. Applications run # DPDK_NETDEV DPDK is a set of libraries for fast packet processing. Applications run
in user-space and communicate directly with dedicated network interfaces. # DPDK_NETDEV in user-space and communicate directly with dedicated network interfaces.
. # DPDK_NETDEV .
This package provides a DPDK enabled implementation of the ovs-vswitchd # DPDK_NETDEV This package provides a DPDK enabled implementation of the ovs-vswitchd
binary. # DPDK_NETDEV binary.
Package: openvswitch-test Package: openvswitch-test
Architecture: all Architecture: all

6
debian/rules vendored
View File

@ -28,6 +28,7 @@ override_dh_auto_configure:
$(EXTRA_CONFIGURE_OPTS) \ $(EXTRA_CONFIGURE_OPTS) \
) )
ifneq (,$(filter i386 amd64 ppc64el arm64, $(DEB_HOST_ARCH))) ifneq (,$(filter i386 amd64 ppc64el arm64, $(DEB_HOST_ARCH)))
ifeq (,$(filter nodpdk, $(DEB_BUILD_OPTIONS)))
test -d _dpdk || mkdir _dpdk test -d _dpdk || mkdir _dpdk
cd _dpdk && ( \ cd _dpdk && ( \
test -e Makefile || \ test -e Makefile || \
@ -37,6 +38,7 @@ ifneq (,$(filter i386 amd64 ppc64el arm64, $(DEB_HOST_ARCH)))
$(EXTRA_CONFIGURE_OPTS) \ $(EXTRA_CONFIGURE_OPTS) \
) )
endif endif
endif
# NOTE(jamespage): by default, just run all tests # NOTE(jamespage): by default, just run all tests
@ -61,12 +63,14 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
# Skip DPDK testing on arm64 as builders don't have crc32 support # Skip DPDK testing on arm64 as builders don't have crc32 support
# which is used in aarch64 based crc optimization in ovs >= 2.12.0~ # which is used in aarch64 based crc optimization in ovs >= 2.12.0~
ifneq (,$(filter i386 amd64 ppc64el, $(DEB_HOST_ARCH))) ifneq (,$(filter i386 amd64 ppc64el, $(DEB_HOST_ARCH)))
ifeq (,$(filter nodpdk, $(DEB_BUILD_OPTIONS)))
if $(MAKE) -C _dpdk check TESTSUITEFLAGS='$(PARALLEL) $(TEST_LIST_DPDK)' || \ if $(MAKE) -C _dpdk check TESTSUITEFLAGS='$(PARALLEL) $(TEST_LIST_DPDK)' || \
$(MAKE) -C _dpdk check TESTSUITEFLAGS='--recheck'; then :; \ $(MAKE) -C _dpdk check TESTSUITEFLAGS='--recheck'; then :; \
else \ else \
cat _dpdk/tests/testsuite.log; \ cat _dpdk/tests/testsuite.log; \
exit 1; \ exit 1; \
fi fi
endif # nodpdk
endif # i386/amd64/ppc64el endif # i386/amd64/ppc64el
endif # nocheck endif # nocheck
@ -74,8 +78,10 @@ override_dh_auto_build:
dh_auto_build --sourcedirectory=_debian -- dist distdir=openvswitch dh_auto_build --sourcedirectory=_debian -- dist distdir=openvswitch
dh_auto_build --sourcedirectory=_debian dh_auto_build --sourcedirectory=_debian
ifneq (,$(filter i386 amd64 ppc64el arm64, $(DEB_HOST_ARCH))) ifneq (,$(filter i386 amd64 ppc64el arm64, $(DEB_HOST_ARCH)))
ifeq (,$(filter nodpdk, $(DEB_BUILD_OPTIONS)))
dh_auto_build --sourcedirectory=_dpdk dh_auto_build --sourcedirectory=_dpdk
endif endif
endif
execute_before_dh_auto_clean: execute_before_dh_auto_clean:
find . -name "*.pyc" -delete find . -name "*.pyc" -delete