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 https://github.com/tfherbert/dpdk-snap.git
92 git checkout $COPR_DPDK_VERSION
94 echo "---------------------"
95 echo "Build DPDK RPM version $DPDK_VERSION"
98 git clone $DPDK_REPO_URL
100 if [[ "$DPDK_VERSION" =~ "master" ]]; then
102 snapgit=`git log --pretty=oneline -n1|cut -c1-8`
104 git checkout v$DPDK_VERSION
105 snapgit=`grep "define snapver" $TMPDIR/copr/dpdk-snap/dpdk.spec | cut -c25-33`
108 cp $TMPDIR/copr/dpdk-snap/dpdk.spec $TMPDIR/dpdk
109 cp $TMPDIR/copr/dpdk-snap/dpdk.spec $RPMDIR/SPECS
110 cp $TMPDIR/copr/dpdk-snap/*.patch $TMPDIR/copr/dpdk-snap/sources $TMPDIR/copr/dpdk-snap/dpdk-snapshot.sh $RPMDIR/SOURCES
111 snapser=`git log --pretty=oneline | wc -l`
113 makever=`make showversion`
114 basever=`echo ${makever} | cut -d- -f1`
115 prefix=dpdk-${basever:0:5}
117 archive=${prefix}.tar.gz
118 DPDK_VERSION=$basever
120 echo "-------------------------------"
121 echo "Creating ${archive}"
123 git archive --prefix=${prefix}/ HEAD | gzip -9 > ${archive}
124 cp ${archive} $RPMDIR/SOURCES/
125 echo "-------------------------------"
126 echo building RPM for DPDK version $DPDK_VERSION
128 rpmbuild -bb --define "_topdir $RPMDIR" dpdk.spec
130 echo "-------------------------------"
131 echo Delete all rpms from $HOME
137 echo "-------------------------------"
140 cp $RPMDIR/RPMS/x86_64/*.rpm $HOME