blob: 60b92e6f4eb041fbec145c30cdd610a98df017ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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
|