[ovs-dev] [PATCH v2 2/2] travis: Make it possible to build against a dpdk branch.

David Marchand david.marchand at redhat.com
Wed Jun 19 07:26:29 UTC 2019


Rework the build script so that we can pass branches and tags.

With this, DPDK_VER can be passed as:
- a string starting with refs/ which is understood as a git reference.
  This triggers a git clone on DPDK_GIT (default value points to
  https://dpdk.org/git/dpdk) for a single branch pointing to this
  reference (to save some disk),
- else, any other string which is understood as an official release.
  This triggers a tarball download on dpdk.org.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
Changelog since v1:
- removed (now unneeded) directory renames
- added a "git log" so that we have the current git revision in the logs

---
 .travis/linux-build.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 3a5c4a2..9d84411 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -65,16 +65,16 @@ function install_kernel()
 
 function install_dpdk()
 {
-    if [ -n "$DPDK_GIT" ]; then
-        git clone $DPDK_GIT dpdk-$1
-        cd dpdk-$1
-        git checkout tags/v$1
+    if [ "${1##refs/*/}" != "${1}" ]; then
+        DPDK_GIT=${DPDK_GIT:-https://dpdk.org/git/dpdk}
+        git clone --single-branch $DPDK_GIT dpdk-git -b "${1##refs/*/}"
+        cd dpdk-git
+        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"/")
-        if [ $DIR_NAME != "dpdk-$1"  ]; then mv $DIR_NAME dpdk-$1; fi
-        cd dpdk-$1
+        cd $DIR_NAME
     fi
 
     make config CC=gcc T=$TARGET
@@ -89,6 +89,7 @@ function install_dpdk()
     sed -i '/CONFIG_RTE_KNI_KMOD=y/s/=y/=n/' build/.config
 
     make -j4 CC=gcc EXTRA_CFLAGS='-fPIC'
+    EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/build"
     echo "Installed DPDK source in $(pwd)"
     cd ..
 }
@@ -111,7 +112,6 @@ if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
         # Disregard cast alignment errors until DPDK is fixed
         CFLAGS="$CFLAGS -Wno-cast-align"
     fi
-    EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/dpdk-$DPDK_VER/build"
 fi
 
 OPTS="$EXTRA_OPTS $*"
-- 
1.8.3.1



More information about the dev mailing list