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 echo "---------------------"
65 echo "Install dependencies for dpdk"
67 sudo yum -y install gcc make python-devel openssl-devel autoconf automake rpm-build \
68 redhat-rpm-config libtool libpcap-devel numactl-devel python-sphinx \
76 mkdir -p $HOME/rpmbuild/RPMS
77 mkdir -p $HOME/rpmbuild/SOURCES
78 mkdir -p $HOME/rpmbuild/SPECS
79 mkdir -p $HOME/rpmbuild/SRPMS
84 # Use Fedora copr spec file
86 echo "---------------------"
87 echo "Get copr distribution git"
90 git clone http://copr-dist-git.fedorainfracloud.org/cgit/pmatilai/dpdk/dpdk.git
92 echo "---------------------"
93 echo "Build DPDK RPM version $DPDK_VERSION"
96 git clone $DPDK_REPO_URL
98 if [[ "$DPDK_VERSION" =~ "master" ]]; then
100 snapgit=`git log --pretty=oneline -n1|cut -c1-8`
102 git checkout v$DPDK_VERSION
103 snapgit=`grep "define snapver" $TMPDIR/copr/dpdk/dpdk.spec | cut -c25-33`
106 cp $TMPDIR/copr/dpdk/dpdk.spec $TMPDIR/dpdk
107 cp $TMPDIR/copr/dpdk/dpdk.spec $RPMDIR/SPECS
108 cp $TMPDIR/copr/dpdk/*.patch $TMPDIR/copr/dpdk/sources $TMPDIR/copr/dpdk/dpdk-snapshot.sh $RPMDIR/SOURCES
109 snapser=`git log --pretty=oneline | wc -l`
111 makever=`make showversion`
112 basever=`echo ${makever} | cut -d- -f1`
115 archive=${prefix}.tar.gz
116 DPDK_VERSION=$basever
118 echo "-------------------------------"
119 echo "Creating ${archive}"
121 git archive --prefix=${prefix}/ HEAD | gzip -9 > ${archive}
122 cp ${archive} $RPMDIR/SOURCES/
123 echo "-------------------------------"
124 echo building RPM for DPDK version $DPDK_VERSION
126 rpmbuild -bb --define "_topdir $RPMDIR" dpdk.spec
128 echo "-------------------------------"
131 cp $RPMDIR/RPMS/x86_64/*.rpm $HOME