1 # lib_vpp.sh - Docker build script VPP library.
4 # Copyright (c) 2020 Cisco and/or its affiliates.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at:
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Don't import more than once.
18 if [ -n "$(alias lib_vpp_imported 2> /dev/null)" ] ; then
21 alias lib_vpp_imported=true
23 export CIMAN_DOCKER_SCRIPTS=${CIMAN_DOCKER_SCRIPTS:-"$(dirname $BASH_SOURCE)"}
24 . $CIMAN_DOCKER_SCRIPTS/lib_common.sh
28 local branch=${2:-"master"}
29 local branchname="$(echo $branch | sed -e 's,/,_,')"
30 local bld_log="$DOCKER_BUILD_LOG_DIR"
31 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
32 bld_log="${bld_log}-make_vpp_${target}-bld.log"
34 makefile_target="^${target}:"
35 if [ -z "$(grep $makefile_target Makefile)" ] ; then
36 echo "Make target '$target' does not exist in VPP branch '$branch'!"
40 description="'make UNATTENDED=y $target' in $(pwd) ($branch)"
41 echo_log -e " Starting $description..."
42 local force_opts="--allow-downgrades --allow-remove-essential"
43 force_opts="$force_opts --allow-change-held-packages"
44 make UNATTENDED=y CONFIRM="-y" FORCE="$force_opts" \
45 $target 2>&1 | tee -a "$bld_log"
47 echo_log " Completed $description!"
52 local branch=${2:-"master"}
53 local branchname="$(echo $branch | sed -e 's,/,_,')"
54 local bld_log="$DOCKER_BUILD_LOG_DIR"
55 bld_log="${bld_log}/$FDIOTOOLS_IMAGENAME-$branchname"
56 bld_log="${bld_log}-make_vpp_test_${target}-bld.log"
58 makefile_target="^${target}:"
59 if [ -z "$(grep -e $makefile_target test/Makefile)" ] ; then
60 echo "Make test target '$target' does not exist in VPP branch '$branch'!"
64 description="'make -C test $target' in $(pwd) ($branch)"
65 echo_log " Starting $description..."
66 make WS_ROOT="$DOCKER_VPP_DIR" BR="$DOCKER_VPP_DIR/build-root" \
67 TEST_DIR="$DOCKER_VPP_DIR/test" -C test $target 2>&1 | tee -a $bld_log
68 remove_pyc_files_and_pycache_dirs
70 echo_log " Completed $description!"
73 docker_build_setup_vpp() {
74 if [ ! -d "$DOCKER_VPP_DIR" ] ; then
75 echo_log "Cloning VPP into $DOCKER_VPP_DIR..."
76 git clone -q https://gerrit.fd.io/r/vpp $DOCKER_VPP_DIR
78 clean_git_repo $DOCKER_VPP_DIR
81 # Branches must be listed in chronological order -- oldest stable branch
82 # first and master last.
83 declare -A VPP_BRANCHES
84 VPP_BRANCHES["centos-7"]="stable/1908 stable/2001 stable/2005 stable/2009"
85 VPP_BRANCHES["centos-8"]="stable/2009 master"
86 VPP_BRANCHES["debian-9"]="stable/2009 master"
87 VPP_BRANCHES["debian-10"]="stable/2009 master"
88 VPP_BRANCHES["ubuntu-18.04"]="stable/1908 stable/2001 stable/2005 stable/2009 master"
89 VPP_BRANCHES["ubuntu-20.04"]="stable/2009 master"