HC Tests: remove trusty from download_hc_*.sh scripts
[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 VPP_ARTIFACTS="vpp vpp-lib vpp-plugins vpp-api-java"
29
30 if [ "${OS}" == "ubuntu1604" ]; then
31     OS="ubuntu.xenial.main"
32     PACKAGE="deb deb.md5"
33     CLASS="deb"
34 elif [ "${OS}" == "centos7" ]; then
35     OS="centos7"
36     PACKAGE="rpm rpm.md5"
37     CLASS=""
38 fi
39
40 REPO="fd.io.${STREAM}.${OS}"
41
42 for ART in ${VPP_ARTIFACTS}; do
43     for PAC in ${PACKAGE}; do
44         curl "${URL}?r=${REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
45     done
46 done
47
48 # TODO(CSIT-994): reenable NSH
49 # for ART in ${NSH_ARTIFACTS}; do
50 #     for PAC in ${PACKAGE}; do
51 #         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
52 #     done
53 # done
54
55 # verify downloaded packages
56 if [ "${OS}" == "centos7" ]; then
57     FILES=*.rpm
58 else
59     FILES=*.deb
60 fi
61
62 for FILE in ${FILES}; do
63     echo " "${FILE} >> ${FILE}.md5
64 done
65 for MD5FILE in *.md5; do
66     md5sum -c ${MD5FILE} || exit
67     rm ${MD5FILE}
68 done
69
70 # install vpp-api-java, this extracts jvpp .jar files into usr/share/java
71 if [ "${OS}" == "centos7" ]; then
72     sudo rpm --nodeps --install vpp-api-java*
73 else
74     sudo dpkg --ignore-depends=vpp --install vpp-api-java*
75 fi
76
77 # install jvpp jars into maven repo, so that maven picks them up when building hc2vpp
78 version=`../jvpp/version`
79
80 current_dir=`pwd`
81 cd /usr/share/java
82
83 for item in jvpp*.jar; do
84     # Example filename: jvpp-registry-17.01-20161206.125556-1.jar
85     # ArtifactId = jvpp-registry
86     # Version = 17.01
87     basefile=$(basename -s .jar "$item")
88     artifactId=$(echo "$basefile" | cut -d '-' -f 1-2)
89     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
90 done
91
92 cd ${current_dir}