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}
79 if [ -z $OVS_REPO_URL ]; then
80 OVS_REPO_URL=https://github.com/openvswitch/ovs.git
83 if [ ! -z $kernel_major ] && [ ! -z $kernel_minor ]; then
84 kernel_version=$kernel_major.$kernel_minor
85 echo ===================
86 echo Will install kernel version: major is $kernel_major and minor is $kernel_minor
87 echo ===================
89 echo Will use default kernel in ovs test vm
92 if [ ! -z $DPDK ]; then
96 if [ -z ${WORKSPACE+1} ]; then
97 # We are not being run by Jenkins.
98 export WORKSPACE=$HOME/opnfv/ovsnfv
101 git clone https://git.opnfv.org/ovsnfv
104 export BUILD_BASE=$WORKSPACE/build
108 if [ ! -d $BUILD_BASE ]
113 if [ ! -f $BUILD_BASE/config ]; then
114 touch $BUILD_BASE/config
117 export PATH=$PATH:$WORKSPACE/ci:$BUILD_BASE
118 source $BUILD_BASE/config
121 export TOPDIR=$BUILD_BASE
125 export TMP_RELEASE_DIR=$TOPDIR/release
126 export CACHE_DIR=$TOPDIR/cache
127 export TMPDIR=$TOPDIR/scratch
128 export RPMDIR=$TOPDIR/rpmbuild
131 mkdir -p $RPMDIR/RPMS
132 mkdir -p $RPMDIR/SOURCES
133 mkdir -p $RPMDIR/SPECS
134 mkdir -p $RPMDIR/SRPMS
137 if [ ! -z $TESTRPM ]; then
138 # Spawn VM to do the testing.
139 if [ ! -z $kernel_version ]; then
140 instack_ovs.sh -a $kernel_major -g $TAG -i $kernel_minor -p $OVS_PATCH -t -u $OVS_REPO_URL
142 instack_ovs.sh $setbuilddpdk -g $TAG -p $OVS_PATCH -t -u $OVS_REPO_URL
146 build_ovs_rpm.sh $setbuilddpdk -g $TAG -p $OVS_PATCH -u $OVS_REPO_URL
147 cp $HOME/rpmbuild/RPMS/* $TMP_RELEASE_DIR