summaryrefslogtreecommitdiffstats
path: root/build/build_ovs_rpm.sh
diff options
context:
space:
mode:
authorThomas F Herbert <therbert@redhat.com>2016-01-23 19:06:55 -0500
committerThomas F Herbert <therbert@redhat.com>2016-01-31 00:16:08 -0500
commit4c54b37aca48867c694539692a3ada76be39f4d6 (patch)
treea99b48f4420c53058fad82260a752b3f4dcb9aa3 /build/build_ovs_rpm.sh
parent4aa1ce14bb812da904f65e8c8f6e6a92053a41e3 (diff)
Introduce ability to accept command arguments to build with DPDK or Linux kernel.
Specify patches to apply, build kernel module RPM and build with a special version of the kernel. Also instack_ovs.sh creates a VM for building and initial testing of RPMs and copies scripts to VMs build_ovs_rpm.sh builds the RPM according to command line options. test_ovs_rpm.sh tests the RPM by installing the RPM and running some ovs commands to create a bridge and dump flows. Also add two scripts generally to be executed in VM to do actual building and Testing. This 2nd series adds the following: Use fedora spec file for kmod builds. Added Explanations to configuration options. Fixes in response to review comments. Rename script for clarity and change references: buildtestovs.sh -> BuildTestOVS.sh Fix nocheck option, print default options, fix kmod option, fix test of kmod. For command line options execute build/buildtestovs.sh -h Change-Id: I415ca39afab27482b1cb473d392f48b36c8e0745 Signed-off-by: Thomas F Herbert <therbert@redhat.com>
Diffstat (limited to 'build/build_ovs_rpm.sh')
-rwxr-xr-xbuild/build_ovs_rpm.sh130
1 files changed, 130 insertions, 0 deletions
diff --git a/build/build_ovs_rpm.sh b/build/build_ovs_rpm.sh
new file mode 100755
index 0000000..60b92e6
--- /dev/null
+++ b/build/build_ovs_rpm.sh
@@ -0,0 +1,130 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2016 Red Hat Inc. and others.
+# therbert@redhat.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+set -e
+declare -i CNT
+
+echo "==============================="
+echo executing $0 $@
+echo executing on machine `uname -a`
+
+usage() {
+ echo run BuildAndTestOVS -h for help
+}
+
+while getopts "cdg:hkp:u:v" opt; do
+ case "$opt" in
+ c)
+ setnocheck="--without check"
+ ;;
+ d)
+ DPDK="yes"
+ ;;
+ g)
+ TAG=${OPTARG}
+ ;;
+ h|\?)
+ usage
+ exit 1
+ ;;
+ k)
+ kmod="yes"
+ ;;
+ p)
+ OVS_PATCH=${OPTARG}
+ ;;
+ u)
+ OVS_REPO_URL=${OPTARG}
+ ;;
+ v)
+ verbose="yes"
+ ;;
+ esac
+done
+
+HOME=`pwd`
+TOPDIR=$HOME
+TMPDIR=$TOPDIR/ovsrpm
+
+if [ -d $TMPDIR ]
+then
+ rm -rf $TMPDIR
+fi
+
+sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
+ kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
+ libtool
+
+VERSION=2.3.90
+os_type=fedora
+kernel_version=$(uname -a | awk '{print $3}')
+
+mkdir -p $TMPDIR
+
+cd $TMPDIR
+
+mkdir -p $HOME/rpmbuild/RPMS
+mkdir -p $HOME/rpmbuild/SOURCES
+mkdir -p $HOME/rpmbuild/SPECS
+mkdir -p $HOME/rpmbuild/SRPMS
+
+RPMDIR=$HOME/rpmbuild
+
+
+echo "---------------------"
+echo "Clone git repo $OVS_REPO_URL and checkout branch or tag $TAG"
+echo
+git clone $OVS_REPO_URL
+
+cd ovs
+echo "--------------------"
+echo "Checkout OVS $TAG"
+echo
+if [[ ! "$TAG" =~ "master" ]]; then
+ git checkout $TAG
+fi
+if [[ ! "$OVS_PATCH" =~ "no" ]]; then
+ echo "Apply patches from $OVS_PATCH"
+fi
+./boot.sh
+if [ ! -z $DPDK ]; then
+ ./configure --with-dpdk
+else
+ ./configure --with-linux=/lib/modules/`uname -r`/build
+fi
+echo "--------------------"
+echo "Make OVS $TAG"
+echo
+make
+
+if [[ "$TAG" =~ "master" ]]; then
+ v=$($TMPDIR/ovs/utilities/ovs-vsctl --version | head -1 | cut -d' ' -f4)
+ export VERSION=$v
+else
+ export VERSION=${TAG:1}
+fi
+
+echo making RPM for Open vswitch version $VERSION
+make dist
+
+echo cp openvswitch-*.tar.gz $HOME/rpmbuild/SOURCES
+cp openvswitch-*.tar.gz $HOME/rpmbuild/SOURCES
+
+if [ ! -z $kmod ]; then
+ echo "Building kernel module..."
+ rpmbuild -bb -D "kversion $kernel_version" -D "kflavors default" --define "_topdir `echo $RPMDIR`" $setnocheck rhel/openvswitch-kmod-${os_type}.spec
+echo " Kernel RPM built!"
+fi
+
+echo "Building User Space..."
+rpmbuild -bb --define "_topdir `echo $RPMDIR`" $setnocheck rhel/openvswitch.spec
+
+cp $RPMDIR/RPMS/x86_64/*.rpm $HOME
+
+exit 0