CSIT-544 HC Test: adapt package download script to changes in hc2vpp 48/6048/7
authorselias <samelias@cisco.com>
Wed, 5 Apr 2017 09:54:06 +0000 (11:54 +0200)
committerTibor Frank <tifrank@cisco.com>
Wed, 12 Apr 2017 14:29:19 +0000 (14:29 +0000)
Required after https://gerrit.fd.io/r/5908
hc2vpp packages to be published with a specific VPP version dependency.

Change-Id: I9a31a83ec033a01556b4afd8575d8ccae4139b7f
Signed-off-by: selias <samelias@cisco.com>
resources/tools/download_hc_build_pkgs.sh
resources/tools/download_hc_pkgs.sh

index 9bcaefb..f653b5b 100755 (executable)
@@ -45,13 +45,13 @@ fi
 REPO="fd.io.${STREAM}.${OS}"
 
 for ART in ${VPP_ARTIFACTS}; do
-    for PAC in $PACKAGE; do
+    for PAC in ${PACKAGE}; do
         curl "${URL}?r=${REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
     done
 done
 
 for ART in ${NSH_ARTIFACTS}; do
-    for PAC in $PACKAGE; do
+    for PAC in ${PACKAGE}; do
         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
     done
 done
@@ -63,3 +63,23 @@ done
 for MD5FILE in *.md5; do
     md5sum -c ${MD5FILE} || exit
 done
+
+# installing vpp-api-java places jvpp jars into /usr/share/java
+sudo dpkg -i *.deb
+
+# install jvpp jars into maven repo, so that maven picks them up when building hc2vpp
+version=`./jvpp-version`
+
+current_dir=`pwd`
+cd /usr/share/java
+
+for item in jvpp*.jar; do
+    # Example filename: jvpp-registry-17.01-20161206.125556-1.jar
+    # ArtifactId = jvpp-registry
+    # Version = 17.01
+    basefile=$(basename -s .jar "$item")
+    artifactId=$(echo "$basefile" | cut -d '-' -f 1-2)
+    mvn install:install-file -Dfile=${item} -DgroupId=io.fd.vpp -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=jar -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
+done
+
+cd current_dir
\ No newline at end of file
index 79cccb9..3c7190e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Copyright (c) 2016 Cisco and/or its affiliates.
+# Copyright (c) 2017 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -15,8 +15,6 @@
 
 set -ex
 
-trap 'rm -f *.deb.md5; exit' EXIT
-trap 'rm -f *.deb.md5;rm -f *.deb; exit' ERR
 STREAM=$1
 OS=$2
 
@@ -25,7 +23,6 @@ VER="RELEASE"
 GROUP="io.fd.vpp"
 HC_GROUP="io.fd.hc2vpp"
 NSH_GROUP="io.fd.nsh_sfc"
-VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib vpp-plugins vpp-api-java"
 HC_ARTIFACTS="honeycomb"
 NSH_ARTIFACTS="vpp-nsh-plugin"
 
@@ -33,40 +30,69 @@ if [ "${OS}" == "ubuntu1404" ]; then
     OS="ubuntu.trusty.main"
     PACKAGE="deb deb.md5"
     CLASS="deb"
+    VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-lib vpp-plugins vpp-api-java"
+    DPDK_ARTIFACTS="vpp-dpdk-dkms vpp-dpdk-dev"
 elif [ "${OS}" == "ubuntu1604" ]; then
     OS="ubuntu.xenial.main"
     PACKAGE="deb deb.md5"
     CLASS="deb"
+    VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-lib vpp-plugins vpp-api-java"
+    DPDK_ARTIFACTS="vpp-dpdk-dkms vpp-dpdk-dev"
 elif [ "${OS}" == "centos7" ]; then
     OS="centos7"
     PACKAGE="rpm rpm.md5"
-    CLASS="rpm"
+    CLASS=""
+    VPP_ARTIFACTS="vpp vpp-debuginfo vpp-devel vpp-lib vpp-plugins vpp-api-java"
+    DPDK_ARTIFACTS="vpp-dpdk-devel"
 fi
 
 REPO="fd.io.${STREAM}.${OS}"
 
-for ART in ${VPP_ARTIFACTS}; do
-    for PAC in $PACKAGE; do
-        curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
+# download latest honeycomb, vpp-dpdk and nsh packages
+for ART in ${HC_ARTIFACTS}; do
+    for PAC in ${PACKAGE}; do
+        curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
     done
 done
 
-for ART in ${HC_ARTIFACTS}; do
-    for PAC in $PACKAGE; do
-        curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
+for ART in ${DPDK_ARTIFACTS}; do
+    for PAC in ${PACKAGE}; do
+        curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
     done
 done
 
 for ART in ${NSH_ARTIFACTS}; do
-    for PAC in $PACKAGE; do
+    for PAC in ${PACKAGE}; do
         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
     done
 done
 
-for FILE in *.deb; do
-    echo " "${FILE} >> ${FILE}.md5
+# determine VPP dependency
+if [ "${OS}" == "centos7" ]; then
+    VER=`rpm -qpR honeycomb*.rpm | grep 'vpp ' | cut -d ' ' -f 3`
+    VER=${VER}.x86_64
+else
+    VER=`dpkg -I honeycomb*.deb | grep -oP 'vpp \(= \K[^\)]+'`
+fi
+
+# download VPP packages
+for ART in ${VPP_ARTIFACTS}; do
+    for PAC in ${PACKAGE}; do
+        curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
+    done
 done
 
+# verify downloaded package
+if [ "${OS}" == "centos7" ]; then
+    FILES=*.rpm
+else
+    FILES=*.deb
+fi
+
+for FILE in ${FILES}; do
+    echo " "${FILE} >> ${FILE}.md5
+done
 for MD5FILE in *.md5; do
     md5sum -c ${MD5FILE} || exit
-done
+    rm ${MD5FILE}
+done
\ No newline at end of file

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.