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

©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.