Pylint fixes
[csit.git] / resources / tools / download_hc_build_pkgs.sh
1 #!/bin/bash
2
3 # Copyright (c) 2016 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 trap 'rm -f *.deb.md5; exit' EXIT
19 trap 'rm -f *.deb.md5;rm -f *.deb; exit' ERR
20
21 # Download the latest VPP .deb packages, their matching JVPP .jar and VPP plugin .deb packages
22 URL="https://nexus.fd.io/service/local/artifact/maven/content"
23 VER="LATEST"
24 REPO='fd.io.master.ubuntu.trusty.main'
25 JVPP_REPO='fd.io.snapshot'
26 VPP_GROUP="io.fd.vpp"
27 HC_GROUP="io.fd.hc2vpp"
28 NSH_GROUP="io.fd.nsh_sfc"
29 VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib vpp-plugins"
30 JVPP_ARTIFACTS="jvpp-core jvpp-registry jvpp-acl jvpp-snat jvpp-ioam-pot jvpp-ioam-trace"
31 HC_ARTIFACTS="honeycomb"
32 NSH_ARTIFACTS="vpp-nsh-plugin"
33 PACKAGE="deb deb.md5"
34 JVPP_PACKAGE="jar jar.md5"
35 CLASS="deb"
36
37 for ART in ${VPP_ARTIFACTS}; do
38     for PAC in $PACKAGE; do
39         curl "${URL}?r=${REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
40     done
41 done
42
43 for ART in ${JVPP_ARTIFACTS}; do
44     for PAC in $JVPP_PACKAGE; do
45         curl "${URL}?r=${JVPP_REPO}&g=${VPP_GROUP}&a=${ART}&p=${PAC}&v=${VER}" -O -J || exit
46     done
47 done
48
49 for ART in ${HC_ARTIFACTS}; do
50     for PAC in $PACKAGE; do
51         curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
52     done
53 done
54
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 for FILE in *.deb; do
62     echo " "${FILE} >> ${FILE}.md5
63 done
64
65 for FILE in *.jar; do
66     echo " "${FILE} >> ${FILE}.md5
67 done
68
69 for MD5FILE in *.md5; do
70     md5sum -c ${MD5FILE} || exit
71 done
72
73 # Install JVPP to maven local repo, to be used in HC2VPP build
74 JVPP_JARS=$(find . -type f -iname '*.jar')
75 for item in jvpp*.jar; do
76     # Example filename: jvpp-registry-17.01-20161206.125556-1.jar
77     # ArtifactId = jvpp-registry
78     # Version = 17.01
79     basefile=$(basename -s .jar "$item")
80     artifactId=$(echo "$basefile" | cut -d '-' -f 1-2)
81     version=$(echo "$basefile" | cut -d '-' -f 3)
82     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
83 done