include-raw-hc2vpp-integration-prebuild.sh revision a83d190e
1#!/bin/bash
2
3set -ex
4
5# Download the latest VPP java API package
6URL="https://nexus.fd.io/service/local/artifact/maven/content"
7VERSION="RELEASE"
8GROUP="io.fd.vpp"
9ARTIFACTS="vpp-api-java"
10
11VERSION=`./vpp-version`
12if [ "${VERSION}" != 'RELEASE' ]; then
13    if [ "${OS}" == "centos7" ]; then
14        VERSION="${VERSION}.x86_64"
15    else
16        VERSION="${VERSION}_amd64"
17    fi
18fi
19
20if [ "${OS}" == "ubuntu1604" ]; then
21    OS_PART="ubuntu.xenial.main"
22    PACKAGE="deb deb.md5"
23    CLASS="deb"
24elif [ "${OS}" == "centos7" ]; then
25    OS_PART="centos7"
26    PACKAGE="rpm rpm.md5"
27    CLASS=""
28fi
29
30if [ "${STREAM}" == "master" ]; then
31    STREAM_PART="master"
32else
33    STREAM_PART="stable.${STREAM}"
34fi
35
36REPO="fd.io.${STREAM_PART}.${OS_PART}"
37
38for ART in ${ARTIFACTS}; do
39    for PAC in ${PACKAGE}; do
40        curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VERSION}&c=${CLASS}" -O -J || exit
41    done
42done
43
44# verify downloaded package
45if [ "${OS}" == "centos7" ]; then
46    FILES=*.rpm
47else
48    FILES=*.deb
49fi
50
51for FILE in ${FILES}; do
52    echo " "${FILE} >> ${FILE}.md5
53done
54for MD5FILE in *.md5; do
55    md5sum -c ${MD5FILE} || exit
56    rm ${MD5FILE}
57done
58
59# install vpp-api-java, this extracts jvpp .jar files into usr/share/java
60if [ "${OS}" == "centos7" ]; then
61    sudo rpm --nodeps --install vpp-api-java*
62else
63    sudo dpkg --ignore-depends=vpp --install vpp-api-java*
64fi
65rm vpp-api-java*
66
67# install jvpp jars into maven repo, so that maven picks them up when building hc2vpp
68version=`./jvpp-version`
69
70current_dir=`pwd`
71cd /usr/share/java
72
73for item in jvpp*.jar; do
74    # Example filename: jvpp-registry-17.01-20161206.125556-1.jar
75    # ArtifactId = jvpp-registry
76    # Version = 17.01
77    basefile=$(basename -s .jar "$item")
78    artifactId=$(echo "$basefile" | cut -d '-' -f 1-2)
79    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
80done
81
82cd ${current_dir}
83