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 "==============================="
21 echo executing on machine `uname -a`
24 echo run BuildAndTestOVS -h for complete help on options on ovsnfv scripts.
27 while getopts "g:hp:u:v" opt; do
30 DPDK_VERSION=${OPTARG}
40 DPDK_REPO_URL=${OPTARG}
48 if [ -z $DPDK_REPO_URL ]; then
49 DPDK_REPO_URL=http://dpdk.org/git/dpdk
51 if [ -z $DPDK_VERSION ]; then
64 function install_pre_reqs() {
65 echo "----------------------------------------"
66 echo Install dependencies for dpdk.
68 sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
69 kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
70 libtool python-twisted-core desktop-file-utils groff PyQt4
79 mkdir -p $HOME/rpmbuild/RPMS
80 mkdir -p $HOME/rpmbuild/SOURCES
81 mkdir -p $HOME/rpmbuild/SPECS
82 mkdir -p $HOME/rpmbuild/SRPMS
87 # Use Fedora copr spec file
89 echo "---------------------"
90 echo "Get copr distribution git"
93 git clone https://github.com/tfherbert/dpdk-snap.git
95 git checkout $COPR_DPDK_VERSION
96 echo "---------------------"
97 echo "Apply dpdk dpdk spec file patch"
99 git apply $HOME/patches/spec_file_add_virtio_patch.patch
100 echo "---------------------"
101 echo "Copy in local dpdk patches"
103 cp $HOME/patches/dpdk-16.04-virtio-devargs.patch $TMPDIR/copr/dpdk-snap
105 echo "---------------------"
106 echo "Build DPDK RPM version $DPDK_VERSION"
109 git clone $DPDK_REPO_URL
111 if [[ "$DPDK_VERSION" =~ "master" ]]; then
113 snapgit=`git log --pretty=oneline -n1|cut -c1-8`
115 git checkout v$DPDK_VERSION
116 snapgit=`grep "define snapver" $TMPDIR/copr/dpdk-snap/dpdk.spec | cut -c25-33`
119 cp $TMPDIR/copr/dpdk-snap/dpdk.spec $TMPDIR/dpdk
120 cp $TMPDIR/copr/dpdk-snap/dpdk.spec $RPMDIR/SPECS
121 cp $TMPDIR/copr/dpdk-snap/*.patch $TMPDIR/copr/dpdk-snap/sources $TMPDIR/copr/dpdk-snap/dpdk-snapshot.sh $RPMDIR/SOURCES
122 snapser=`git log --pretty=oneline | wc -l`
124 makever=`make showversion`
125 basever=`echo ${makever} | cut -d- -f1`
126 prefix=dpdk-${basever:0:5}
128 archive=${prefix}.tar.gz
129 DPDK_VERSION=$basever
131 echo "-------------------------------"
132 echo "Creating ${archive}"
134 git archive --prefix=${prefix}/ HEAD | gzip -9 > ${archive}
135 cp ${archive} $RPMDIR/SOURCES/
136 echo "-------------------------------"
137 echo building RPM for DPDK version $DPDK_VERSION
139 rpmbuild -bb --define "_topdir $RPMDIR" dpdk.spec
141 echo "-------------------------------"
142 echo Delete all rpms from $HOME
148 echo "-------------------------------"
151 cp $RPMDIR/RPMS/x86_64/*.rpm $HOME