HC Tests: do not use vpp-dbg in CSIT tests
[csit.git] / resources / tools / scripts / download_hc_build_pkgs.sh
1 #!/bin/bash
2
3 # Copyright (c) 2017 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -ex
17
18 STREAM=$1
19 OS=$2
20
21 # Download the latest VPP and VPP plugin .deb packages
22 URL="https://nexus.fd.io/service/local/artifact/maven/content"
23 VER="RELEASE"
24 VPP_GROUP="io.fd.vpp"
25 # TODO(CSIT-994): reenable NSH
26 # NSH_GROUP="io.fd.nsh_sfc"
27 # NSH_ARTIFACTS="vpp-nsh-plugin"
28
29 if [ "${OS}" == "ubuntu1404" ]; then
30     OS="ubuntu.trusty.main"
31     PACKAGE="deb deb.md5"
32     CLASS="deb"
33     VPP_ARTIFACTS="vpp vpp-lib vpp-plugins vpp-api-java"
34 elif [ "${OS}" == "ubuntu1604" ]; then
35     OS="ubuntu.xenial.main"
36     PACKAGE="deb deb.md5"
37     CLASS="deb"
38     VPP_ARTIFACTS="vpp vpp-lib vpp-plugins vpp-api-java"
39 elif [ "${OS}" == "centos7" ]; then
40     OS="centos7"
41     PACKAGE="rpm rpm.md5"
42     CLASS=""
43     VPP_ARTIFACTS="vpp vpp-lib vpp-plugins vpp-api-java"
44 fi
45
46 REPO="fd.io.${STREAM}.${OS}"
47
48 for ART in ${VPP_ARTIFACTS}; do
49     for PAC in ${PACKAGE}; do
50         curl "${URL}?r=${REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
51     done
52 done
53
54 # TODO(CSIT-994): reenable NSH
55 # for ART in ${NSH_ARTIFACTS}; do
56 #     for PAC in ${PACKAGE}; do
57 #         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
58 #     done
59 # done
60
61 # verify downloaded packages
62 if [ "${OS}" == "centos7" ]; then
63     FILES=*.rpm
64 else
65     FILES=*.deb
66 fi
67
68 for FILE in ${FILES}; do
69     echo " "${FILE} >> ${FILE}.md5
70 done
71 for MD5FILE in *.md5; do
72     md5sum -c ${MD5FILE} || exit
73     rm ${MD5FILE}
74 done
75
76 # install vpp-api-java, this extracts jvpp .jar files into usr/share/java
77 if [ "${OS}" == "centos7" ]; then
78     sudo rpm --nodeps --install vpp-api-java*
79 else
80     sudo dpkg --ignore-depends=vpp --install vpp-api-java*
81 fi
82
83 # install jvpp jars into maven repo, so that maven picks them up when building hc2vpp
84 version=`../jvpp/version`
85
86 current_dir=`pwd`
87 cd /usr/share/java
88
89 for item in jvpp*.jar; do
90     # Example filename: jvpp-registry-17.01-20161206.125556-1.jar
91     # ArtifactId = jvpp-registry
92     # Version = 17.01
93     basefile=$(basename -s .jar "$item")
94     artifactId=$(echo "$basefile" | cut -d '-' -f 1-2)
95     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
96 done
97
98 cd ${current_dir}