summaryrefslogtreecommitdiff
path: root/.ci
diff options
context:
space:
mode:
authorDavid Marchand <david.marchand@redhat.com>2023-05-04 19:10:49 +0200
committerIlya Maximets <i.maximets@ovn.org>2023-05-05 19:19:06 +0200
commit1a1b3106d90e517be416ae14eed625eee240517e (patch)
tree596be38ba4c1a1fb990a9daa5a8273cace2d3ac9 /.ci
parent46240314ac483b93aef081d828b9e86fa9754feb (diff)
downloadopenvswitch-1a1b3106d90e517be416ae14eed625eee240517e.tar.gz
ci: Separate DPDK from OVS build.
Let's separate DPDK compilation from the rest of OVS build: - this avoids multiple jobs building DPDK in parallel, which especially affects builds in the dpdk-latest branch, - we separate concerns about DPDK build requirements from OVS build requirements, like python dependencies, - building DPDK does not depend on how we will link OVS against it, so we can use a single cache entry regardless of DPDK_SHARED option, Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David Marchand <david.marchand@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to '.ci')
-rwxr-xr-x.ci/dpdk-build.sh54
-rwxr-xr-x.ci/dpdk-prepare.sh11
-rwxr-xr-x.ci/linux-build.sh64
-rwxr-xr-x.ci/linux-prepare.sh3
4 files changed, 71 insertions, 61 deletions
diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh
new file mode 100755
index 000000000..02dcefef6
--- /dev/null
+++ b/.ci/dpdk-build.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+set -o errexit
+set -x
+
+function build_dpdk()
+{
+ local VERSION_FILE="dpdk-dir/cached-version"
+ local DPDK_VER=$1
+ local DPDK_OPTS=""
+
+ rm -rf dpdk-dir
+
+ if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
+ git clone --single-branch $DPDK_GIT dpdk-dir -b "${DPDK_VER##refs/*/}"
+ pushd dpdk-dir
+ git log -1 --oneline
+ else
+ wget https://fast.dpdk.org/rel/dpdk-$1.tar.xz
+ tar xvf dpdk-$1.tar.xz > /dev/null
+ DIR_NAME=$(tar -tf dpdk-$1.tar.xz | head -1 | cut -f1 -d"/")
+ mv ${DIR_NAME} dpdk-dir
+ pushd dpdk-dir
+ fi
+
+ # Switching to 'default' machine to make dpdk-dir cache usable on
+ # different CPUs. We can't be sure that all CI machines are exactly same.
+ DPDK_OPTS="$DPDK_OPTS -Dmachine=default"
+
+ # Disable building DPDK unit tests. Not needed for OVS build or tests.
+ DPDK_OPTS="$DPDK_OPTS -Dtests=false"
+
+ # Disable DPDK developer mode, this results in less build checks and less
+ # meson verbose outputs.
+ DPDK_OPTS="$DPDK_OPTS -Ddeveloper_mode=disabled"
+
+ # OVS compilation and "normal" unit tests (run in the CI) do not depend on
+ # any DPDK driver being present.
+ # We can disable all drivers to save compilation time.
+ DPDK_OPTS="$DPDK_OPTS -Ddisable_drivers=*/*"
+
+ # Install DPDK using prefix.
+ DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
+
+ meson $DPDK_OPTS build
+ ninja -C build
+ ninja -C build install
+
+ echo "Installed DPDK in $(pwd)"
+ popd
+ echo "${DPDK_VER}" > ${VERSION_FILE}
+}
+
+build_dpdk $DPDK_VER
diff --git a/.ci/dpdk-prepare.sh b/.ci/dpdk-prepare.sh
new file mode 100755
index 000000000..f7e6215dd
--- /dev/null
+++ b/.ci/dpdk-prepare.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -ev
+
+# Installing wheel separately because it may be needed to build some
+# of the packages during dependency backtracking and pip >= 22.0 will
+# abort backtracking on build failures:
+# https://github.com/pypa/pip/issues/10655
+pip3 install --disable-pip-version-check --user wheel
+pip3 install --disable-pip-version-check --user pyelftools
+pip3 install --user 'meson==0.53.2'
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 10021fddb..99850a943 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -9,9 +9,7 @@ EXTRA_OPTS="--enable-Werror"
function install_dpdk()
{
- local DPDK_VER=$1
local VERSION_FILE="dpdk-dir/cached-version"
- local DPDK_OPTS=""
local DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu
if [ "$DPDK_SHARED" ]; then
@@ -24,63 +22,14 @@ function install_dpdk()
# Export the following path for pkg-config to find the .pc file.
export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH
- if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
- # Avoid using cache for git tree build.
- rm -rf dpdk-dir
-
- DPDK_GIT=${DPDK_GIT:-https://dpdk.org/git/dpdk}
- git clone --single-branch $DPDK_GIT dpdk-dir -b "${DPDK_VER##refs/*/}"
- pushd dpdk-dir
- git log -1 --oneline
- else
- if [ -f "${VERSION_FILE}" ]; then
- VER=$(cat ${VERSION_FILE})
- if [ "${VER}" = "${DPDK_VER}" ]; then
- # Update the library paths.
- sudo ldconfig
- echo "Found cached DPDK ${VER} build in $(pwd)/dpdk-dir"
- return
- fi
- fi
- # No cache or version mismatch.
- rm -rf dpdk-dir
- wget https://fast.dpdk.org/rel/dpdk-$1.tar.xz
- tar xvf dpdk-$1.tar.xz > /dev/null
- DIR_NAME=$(tar -tf dpdk-$1.tar.xz | head -1 | cut -f1 -d"/")
- mv ${DIR_NAME} dpdk-dir
- pushd dpdk-dir
+ if [ ! -f "${VERSION_FILE}" ]; then
+ echo "Could not find DPDK in $(pwd)/dpdk-dir"
+ return 1
fi
- # Switching to 'default' machine to make dpdk-dir cache usable on
- # different CPUs. We can't be sure that all CI machines are exactly same.
- DPDK_OPTS="$DPDK_OPTS -Dmachine=default"
-
- # Disable building DPDK unit tests. Not needed for OVS build or tests.
- DPDK_OPTS="$DPDK_OPTS -Dtests=false"
-
- # Disable DPDK developer mode, this results in less build checks and less
- # meson verbose outputs.
- DPDK_OPTS="$DPDK_OPTS -Ddeveloper_mode=disabled"
-
- # OVS compilation and "normal" unit tests (run in the CI) do not depend on
- # any DPDK driver being present.
- # We can disable all drivers to save compilation time.
- DPDK_OPTS="$DPDK_OPTS -Ddisable_drivers=*/*"
-
- # Install DPDK using prefix.
- DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
-
- CC=gcc meson $DPDK_OPTS build
- ninja -C build
- ninja -C build install
-
# Update the library paths.
sudo ldconfig
-
-
- echo "Installed DPDK source in $(pwd)"
- popd
- echo "${DPDK_VER}" > ${VERSION_FILE}
+ echo "Found cached DPDK $(cat ${VERSION_FILE}) build in $(pwd)/dpdk-dir"
}
function configure_ovs()
@@ -130,10 +79,7 @@ assert ovs.json.from_string('{\"a\": 42}') == {'a': 42}"
fi
if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
- if [ -z "$DPDK_VER" ]; then
- DPDK_VER="22.11.1"
- fi
- install_dpdk $DPDK_VER
+ install_dpdk
fi
if [ "$CC" = "clang" ]; then
diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
index f414a879c..c28b6819a 100755
--- a/.ci/linux-prepare.sh
+++ b/.ci/linux-prepare.sh
@@ -23,8 +23,7 @@ cd ..
# https://github.com/pypa/pip/issues/10655
pip3 install --disable-pip-version-check --user wheel
pip3 install --disable-pip-version-check --user \
- flake8 'hacking>=3.0' netaddr pyparsing sphinx setuptools pyelftools
-pip3 install --user 'meson==0.53.2'
+ flake8 'hacking>=3.0' netaddr pyparsing sphinx setuptools
# Install python test dependencies
pip3 install -r python/test_requirements.txt