Merge "- Add jobs for branch stable/2101 aarch64 - Trigger checkstyle for stable...
[ci-management.git] / docker / scripts / dbld_vpp_install_packages.sh
1 #! /bin/bash
2
3 # Copyright (c) 2021 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 -euxo pipefail
17
18 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname $BASH_SOURCE)"}
19 . "$CIMAN_DOCKER_SCRIPTS/lib_vpp.sh"
20 . "$CIMAN_DOCKER_SCRIPTS/lib_apt.sh"
21 . "$CIMAN_DOCKER_SCRIPTS/lib_yum.sh"
22 . "$CIMAN_DOCKER_SCRIPTS/lib_dnf.sh"
23
24 must_be_run_in_docker_build
25
26 echo_log
27 if ! vpp_supported_executor_class "$FDIOTOOLS_EXECUTOR_CLASS" ; then
28     echo_log "VPP is not supported on executor class '$FDIOTOOLS_EXECUTOR_CLASS'. Skipping $(basename $0)..."
29     exit 0
30 else
31     echo_log "Starting  $(basename $0)"
32 fi
33
34 do_git_config vpp
35 for branch in ${VPP_BRANCHES[$OS_NAME]} ; do
36     do_git_branch "$branch"
37
38     # Install OS packages
39     make_vpp "install-dep" "$branch"
40     make_vpp "centos-pyyaml" "$branch" # VPP Makefile tests for centos versions
41     if [ "$OS_ID" = "ubuntu" ] ; then
42         # 'Make docs jobs are only run on ubuntu executors
43         #  so only run for ubuntu build executors.
44         make_vpp "docs-venv" "$branch"
45     elif [ "$OS_NAME" = "debian-9" ] ; then
46         apt_override_cmake_install_with_pip3_version
47     fi
48
49     # Download, build, and cache external deps packages
50     make_vpp "install-ext-deps" "$branch"
51     vpp_ext_dir="$DOCKER_VPP_DIR/build/external"
52     rsync -ac $vpp_ext_dir/downloads/. $DOCKER_DOWNLOADS_DIR || true
53     if which apt >/dev/null ; then
54         vpp_ext_deps_pkg=$vpp_ext_dir/$(dpkg -l vpp-ext-deps 2>/dev/null | mawk '/vpp-ext-deps/{print $2"_"$3"_"$4".deb"}')
55     elif which dnf >/dev/null ; then
56         inst_vpp_ext_deps="$(dnf list vpp-ext-deps 2>/dev/null | grep vpp-ext-deps)"
57         vpp_ext_deps_ver="$(echo $inst_vpp_ext_deps | mawk '{print $2}')"
58         vpp_ext_deps_arch="$(echo $inst_vpp_ext_deps | mawk '{print $1}'| cut -d'.' -f2)"
59         vpp_ext_deps_pkg="$vpp_ext_dir/vpp-ext-deps-${vpp_ext_deps_ver}.${vpp_ext_deps_arch}.rpm"
60     elif which yum >/dev/null ; then
61         inst_vpp_ext_deps="$(yum list vpp-ext-deps 2>/dev/null | grep vpp-ext-deps)"
62         vpp_ext_deps_ver="$(echo $inst_vpp_ext_deps | mawk '{print $2}')"
63         vpp_ext_deps_arch="$(echo $inst_vpp_ext_deps | mawk '{print $1}' | cut -d'.' -f2)"
64         vpp_ext_deps_pkg="$vpp_ext_dir/vpp-ext-deps-${vpp_ext_deps_ver}.${vpp_ext_deps_arch}.rpm"
65     else
66         echo "ERROR: Package Manager not installed!"
67         exit 1
68     fi
69     if [ -f "$vpp_ext_deps_pkg" ] ; then
70         cp -f $vpp_ext_deps_pkg $DOCKER_DOWNLOADS_DIR
71     else
72         echo "ERROR: Missing VPP external deps package: '$vpp_ext_deps_pkg'"
73         exit 1
74     fi
75     # Install/cache python packages
76     if [ "$OS_ID" = "ubuntu" ] ; then
77         make_vpp_test "test-dep" "$branch"
78         make_vpp_test "doc" "$branch"
79         make_vpp test-wipe "$branch"
80         make_vpp "bootstrap-doxygen" "$branch"
81     fi
82
83     # Dump packages installed
84     case "$DOCKERFILE_FROM" in
85         *ubuntu*)
86             dump_apt_package_list "$branch" ;;
87         *debian*)
88             dump_apt_package_list "$branch" ;;
89         *centos:7)
90             dump_yum_package_list "$branch" ;;
91         *centos:8)
92             dump_dnf_package_list "$branch" ;;
93     esac
94 done
95
96 echo_log -e "Completed $(basename $0)!\n\n=========="