3 # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
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.
19 echo "==============================="
24 echo "$0 -a <kernel major> -d -g <OVS TAG> -h\
25 -i <kernel minor> -p <patch url> -t -u <OVS URL> -v <verbose\
26 -a <kernel major> -- Specify major release if special kernel is required\
27 The default kernel is Centos 7.2 kernel after upgrade.\
28 -d <dpdk> -- Specify dpdk build.\
29 The default is to build ovs for linux kernel data path.\
30 -g <OVS TAG> -- OVS release tag or branch to build such as 2.4.\
31 The default is master.\
32 -h print this message\
33 -i <kernel minor> -- Specify minor release if special kernel is required.\
34 The default kernel is Centos 7.2 kernel after upgrade.\
35 -p <patch url> -- Specify url to patches if required for ovs rpm.\
37 -u <OVS URL> -- path to OVS repo if using fork for patch.\
38 The default is https://github.com/openvswitch/ovs.git\
39 -v -- Set verbose mode."
42 while getopts "a:dg:hi:p:tu:v" opt; do
45 kernel_major=${OPTARG}
58 kernel_minor=${OPTARG}
67 OVS_REPO_URL=${OPTARG}
76 # Default Config options
78 echo ===============================================
79 echo Default Configuration Options.
80 echo ===============================================
81 echo option NOCHECK is set to $NOCHECK
82 echo build DPDK option is set to $DPDK
83 echo DPDK Patch URL is set to $DPDK_PATCH
84 echo DPDK Version is set to $DPDK_VERSION
85 echo Option for OVS Kernel Module is set to $KMOD
86 echo ===============================================
87 if [[ $NOCHECK =~ "yes" ]]; then
90 if [[ $KMOD =~ "yes" ]]; then
93 if [[ $DPDK =~ "yes" ]]; then
97 if [ -z $OVS_REPO_URL ]; then
98 OVS_REPO_URL=https://github.com/openvswitch/ovs.git
101 if [ ! -z $kernel_major ] && [ ! -z $kernel_minor ]; then
102 kernel_version=$kernel_major.$kernel_minor
103 echo ===================
104 echo Will install kernel version: major is $kernel_major and minor is $kernel_minor
105 echo ===================
107 echo Will use default kernel in ovs test vm
114 if [ ! -z $DPDK ]; then
118 if [ -z ${WORKSPACE+1} ]; then
119 # We are not being run by Jenkins.
120 export WORKSPACE=`pwd`
123 if [ -z ${BUILD_BASE+1} ]; then
124 export BUILD_BASE=$WORKSPACE
127 export PATH=$PATH:$BUILD_BASE
130 export TOPDIR=$BUILD_BASE
134 export TMP_RELEASE_DIR=$TOPDIR/release
135 export CACHE_DIR=$TOPDIR/cache
136 export TMPDIR=$TOPDIR/scratch
137 export RPMDIR=$TOPDIR/rpmbuild
140 mkdir -p $RPMDIR/RPMS
141 mkdir -p $RPMDIR/SOURCES
142 mkdir -p $RPMDIR/SPECS
143 mkdir -p $RPMDIR/SRPMS
145 # build dpdk rpm locally.
147 if [[ "$DPDK" =~ "yes" ]]; then
148 echo "==============================="
151 $BUILD_BASE/build_dpdk_rpm.sh -g $DPDK_VERSION
154 # Build locally and copy RPMS
156 echo "==============================="
157 echo build OVS rpm locally
159 ./build_ovs_rpm.sh $setnocheck -g $TAG $setdpdk $setkmod -p $OVS_PATCH -u $OVS_REPO_URL
163 if [ ! -z $TESTRPM ]; then
164 ./test_ovs_rpm.sh $setdpdk $setkmod
168 # If tests pass, copy rpms to release dir
170 echo "==============================="
171 echo copy rpms to release dir
173 cp $RPMDIR/RPMS/x86_64/* $TMP_RELEASE_DIR
174 rm $RPMDIR/RPMS/x86_64/*
177 # Build OVS without DPDK, apply patches and build kmod.
183 echo "==================================================="
184 echo build OVS without DPDK, apply patches and build kmod.
186 ./build_ovs_rpm.sh $setnocheck -g $TAG $setdpdk $setkmod -p $OVS_PATCH -u $OVS_REPO_URL
190 if [ ! -z $TESTRPM ]; then
191 ./test_ovs_rpm.sh $setdpdk $setkmod
195 # If tests pass, copy rpms to release dir
197 echo "==============================="
198 echo copy rpms to release dir and add experimental tag
200 cd $RPMDIR/RPMS/x86_64
201 for i in `ls openvswitch*.rpm`
203 echo copying $i to $TMP_RELEASE_DIR/EXPERIMENTAL-$i
204 cp $i $TMP_RELEASE_DIR/EXPERIMENTAL-$i