Merge "Add INFO.yaml verify job"
[ci-management.git] / jjb / scripts / setup_jvpp_dev_env.sh
1 #!/bin/bash
2 set -e -o pipefail
3
4 # Figure out what system we are running on
5 if [[ -f /etc/lsb-release ]];then
6     . /etc/lsb-release
7 elif [[ -f /etc/redhat-release ]];then
8     sudo yum install -y redhat-lsb
9     DISTRIB_ID=`lsb_release -si`
10     DISTRIB_RELEASE=`lsb_release -sr`
11     DISTRIB_CODENAME=`lsb_release -sc`
12     DISTRIB_DESCRIPTION=`lsb_release -sd`
13 fi
14 echo DISTRIB_ID: $DISTRIB_ID
15 echo DISTRIB_RELEASE: $DISTRIB_RELEASE
16 echo DISTRIB_CODENAME: $DISTRIB_CODENAME
17 echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
18
19 JVPP_VERSION=`./version`
20 echo JVPP_VERSION: $JVPP_VERSION
21 # Check release version
22 if [[ "$JVPP_VERSION" == *"-release" ]]; then
23     # at the time when JVPP release packages are being build,
24     # vpp release packages are already promoted to release repository.
25     # Therefore we need to switch to release repository in order to download
26     # correct vpp package versions
27     STREAM="release"
28 fi
29
30 function setup {
31     if ! [[ -z ${REPO_NAME} ]]; then
32         echo "INSTALLING VPP-DPKG-DEV from apt/yum repo"
33         REPO_URL="https://packagecloud.io/fdio/${STREAM}"
34         echo "REPO_URL: ${REPO_URL}"
35         # Setup by installing vpp-dev and vpp-lib
36         if [[ "$DISTRIB_ID" == "Ubuntu" ]]; then
37             if ! [[ "${STREAM}" == "master" ]]; then
38                 echo "stable branch - clearing all fdio repos. new one will be installed."
39                 sudo rm  -f /etc/apt/sources.list.d/fdio_*.list
40             fi
41             if [[ -f /etc/apt/sources.list.d/99fd.io.list ]];then
42                 echo "Deleting: /etc/apt/sources.list.d/99fd.io.list"
43                 sudo rm /etc/apt/sources.list.d/99fd.io.list
44             fi
45             curl -s https://packagecloud.io/install/repositories/fdio/${STREAM}/script.deb.sh | sudo bash
46             sudo apt-get -y --force-yes install libvppinfra libvppinfra-dev vpp vpp-dev vpp-plugin-core || true
47         elif [[ "$DISTRIB_ID" == "CentOS" ]]; then
48             if [[ -f /etc/yum.repos.d/fdio-master.repo ]]; then
49                 echo "Deleting: /etc/yum.repos.d/fdio-master.repo"
50                 sudo rm /etc/yum.repos.d/fdio-master.repo
51             fi
52             curl -s https://packagecloud.io/install/repositories/fdio/${STREAM}/script.rpm.sh | sudo bash
53             sudo yum -y install vpp-devel vpp-lib vpp-plugins || true
54         fi
55     fi
56 }
57
58 setup