2 ##############################################################################
3 # Copyright (c) 2016 Red Hat Inc. and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
12 echo "==============================="
16 echo "$0 -a <kernel major> -d -g <OVS TAG> -h\
17 -i <kernel minor> -p <patch url> -t -u <OVS URL> -v <verbose\
18 -a <kernel major> -- Specify major release if special kernel is required\
19 The default kernel is Centos 7.2 kernel after upgrade.\
20 -d <dpdk> -- Specify dpdk build.\
21 The default is to build ovs for linux kernel data path.\
22 -g <OVS TAG> -- OVS release tag or branch to build such as 2.4.\
23 The default is master.\
24 -h print this message\
25 -i <kernel minor> -- Specify minor release if special kernel is required.\
26 The default kernel is Centos 7.2 kernel after upgrade.\
27 -p <patch url> -- Specify url to patches if required for ovs rpm.\
29 -u <OVS URL> -- path to OVS repo if using fork for patch.\
30 The default is https://github.com/openvswitch/ovs.git\
31 -v -- Set verbose mode."
34 while getopts "a:dg:hi:p:tu:v" opt; do
37 kernel_major=${OPTARG}
50 kernel_minor=${OPTARG}
59 OVS_REPO_URL=${OPTARG}
71 if [ -z $OVS_REPO_URL ]; then
72 OVS_REPO_URL=https://github.com/openvswitch/ovs.git
75 if [ ! -z $kernel_major ] && [ ! -z $kernel_minor ]; then
76 kernel_version=$kernel_major.$kernel_minor
77 echo ===================
78 echo Will install kernel version: major is $kernel_major and minor is $kernel_minor
79 echo ===================
81 echo Will use default kernel in ovs test vm
84 if [ -z ${WORKSPACE+1} ]; then
85 # We are not being run by Jenkins.
86 export WORKSPACE=$HOME/opnfv/ovsnfv
89 git clone https://git.opnfv.org/ovsnfv
92 export BUILD_BASE=$WORKSPACE/build
96 if [ ! -d $BUILD_BASE ]
101 if [ ! -f $BUILD_BASE/config ]; then
102 touch $BUILD_BASE/config
105 export PATH=$PATH:$WORKSPACE/ci:$BUILD_BASE
106 source $BUILD_BASE/config
109 export TOPDIR=$BUILD_BASE
113 export TMP_RELEASE_DIR=$TOPDIR/release
114 export CACHE_DIR=$TOPDIR/cache
115 export TMPDIR=$TOPDIR/scratch
116 export RPMDIR=$TOPDIR/rpmbuild
119 mkdir -p $RPMDIR/RPMS
120 mkdir -p $RPMDIR/SOURCES
121 mkdir -p $RPMDIR/SPECS
122 mkdir -p $RPMDIR/SRPMS
125 if [ ! -z $TESTRPM ]; then
126 # Spawn VM to do the testing.
127 if [ ! -z $kernel_version ]; then
128 instack_ovs.sh -a $kernel_major -g $TAG -i $kernel_minor -p $OVS_PATCH -t -u $OVS_REPO_URL
130 instack_ovs.sh -g $TAG -p $OVS_PATCH -t -u $OVS_REPO_URL
134 build_ovs_rpm.sh -d -g -p $OVS_PATCH -u $OVS_REPO_URL
135 cp $HOME/rpmbuild/RPMS/* $TMP_RELEASE_DIR
138 echo "--------------------------------------------------"
139 echo "Build OVS RPM from upstream git $OVS_REPO_URL version $TAG"
140 if [ ! -z $OVS_PATCH ]; then
141 echo "Apply patches from: $OVS_PATCH"