Rather than save the whole DPDK sources and build artefacts, checkout
sources in a separate directory and build DPDK there.
Only the installed artefacts are then going to the cache.
Example sources in the share/dpdk installed directory can be pruned too.

This makes a (v23.11-rc3) DPDK cache entry size go from ~120MB to ~7MB.

Signed-off-by: David Marchand <david.march...@redhat.com>
---
 .ci/dpdk-build.sh  | 25 +++++++++++++++----------
 .ci/linux-build.sh |  9 +++++----
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh
index aa83e44643..8380c48637 100755
--- a/.ci/dpdk-build.sh
+++ b/.ci/dpdk-build.sh
@@ -5,25 +5,27 @@ set -x
 
 function build_dpdk()
 {
-    local VERSION_FILE="dpdk-dir/cached-version"
     local DPDK_VER=$1
     local DPDK_OPTS=""
+    local DPDK_INSTALL_DIR="$(pwd)/dpdk-dir"
+    local VERSION_FILE="$DPDK_INSTALL_DIR/cached-version"
 
-    rm -rf dpdk-dir
+    rm -rf dpdk-src
+    rm -rf $DPDK_INSTALL_DIR
 
     if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
-        git clone --single-branch $DPDK_GIT dpdk-dir -b "${DPDK_VER##refs/*/}"
-        pushd dpdk-dir
+        git clone --single-branch $DPDK_GIT dpdk-src -b "${DPDK_VER##refs/*/}"
+        pushd dpdk-src
         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
+        mv ${DIR_NAME} dpdk-src
+        pushd dpdk-src
     fi
 
-    # Switching to 'default' machine to make dpdk-dir cache usable on
+    # Switching to 'default' machine to make the dpdk cache usable on
     # different CPUs. We can't be sure that all CI machines are exactly same.
     DPDK_OPTS="$DPDK_OPTS -Dmachine=default"
 
@@ -42,14 +44,17 @@ function build_dpdk()
     DPDK_OPTS="$DPDK_OPTS -Denable_drivers=$enable_drivers"
 
     # Install DPDK using prefix.
-    DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
+    DPDK_OPTS="$DPDK_OPTS --prefix=$DPDK_INSTALL_DIR"
 
     meson $DPDK_OPTS build
     ninja -C build
     ninja -C build install
-
-    echo "Installed DPDK in $(pwd)"
     popd
+
+    # Remove examples sources.
+    rm -rf $DPDK_INSTALL_DIR/share/dpdk/examples
+
+    echo "Installed DPDK in $DPDK_INSTALL_DIR"
     echo "${DPDK_VER}" > ${VERSION_FILE}
 }
 
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 170f4730f3..ea1e6599f4 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -12,8 +12,9 @@ EXTRA_OPTS="--enable-Werror"
 
 function install_dpdk()
 {
-    local VERSION_FILE="dpdk-dir/cached-version"
-    local DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu
+    local DPDK_INSTALL_DIR="$(pwd)/dpdk-dir"
+    local VERSION_FILE="${DPDK_INSTALL_DIR}/cached-version"
+    local DPDK_LIB=${DPDK_INSTALL_DIR}/lib/x86_64-linux-gnu
 
     if [ "$DPDK_SHARED" ]; then
         EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared"
@@ -29,13 +30,13 @@ function install_dpdk()
     export PATH=$(pwd)/dpdk-dir/build/bin:$PATH
 
     if [ ! -f "${VERSION_FILE}" ]; then
-        echo "Could not find DPDK in $(pwd)/dpdk-dir"
+        echo "Could not find DPDK in $DPDK_INSTALL_DIR"
         return 1
     fi
 
     # Update the library paths.
     sudo ldconfig
-    echo "Found cached DPDK $(cat ${VERSION_FILE}) build in $(pwd)/dpdk-dir"
+    echo "Found cached DPDK $(cat ${VERSION_FILE}) build in $DPDK_INSTALL_DIR"
 }
 
 function configure_ovs()
-- 
2.41.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to