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 <[email protected]>
---
 .travis/linux-build.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index cd8cfcf..ddba2db 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -63,10 +63,13 @@ 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}
+        ref="${1##refs/*/}"
+        git clone --single-branch $DPDK_GIT dpdk-git -b $ref
+        name=$(git --git-dir=dpdk-git/.git describe)
+        mv dpdk-git dpdk-$name
+        cd dpdk-$name
     else
         wget https://fast.dpdk.org/rel/dpdk-$1.tar.xz
         tar xvf dpdk-$1.tar.xz > /dev/null
@@ -87,6 +90,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 ..
 }
@@ -109,7 +113,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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to