X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=build%2FBuildAndTestOVS.sh;h=6017c149a03312b993fdfb2db8a50f9b7eee5f03;hb=68444d67424763ad483df9c02732847e243c4887;hp=ff2495cc3c7288a34277193f5c3e126ead5cb23e;hpb=9e423f6b53784b231ecb3c244bd7f279e94b5ffb;p=ovsnfv.git diff --git a/build/BuildAndTestOVS.sh b/build/BuildAndTestOVS.sh index ff2495c..6017c14 100755 --- a/build/BuildAndTestOVS.sh +++ b/build/BuildAndTestOVS.sh @@ -1,16 +1,24 @@ #!/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 -############################################################################## + +# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -e echo "===============================" echo executing $0 $@ +echo usage() { echo "$0 -a -d -g -h\ @@ -64,8 +72,26 @@ while getopts "a:dg:hi:p:tu:v" opt; do esac done -if [ -z $TAG ]; then - TAG=master +# +# Default Config options +# +echo =============================================== +echo Default Configuration Options. +echo =============================================== +echo option NOCHECK is set to $NOCHECK +echo build DPDK option is set to $DPDK +echo DPDK Patch URL is set to $DPDK_PATCH +echo DPDK Version is set to $DPDK_VERSION +echo Option for OVS Kernel Module is set to $KMOD +echo =============================================== +if [[ $NOCHECK =~ "yes" ]]; then + setnocheck="-c" +fi +if [[ $KMOD =~ "yes" ]]; then + setkmod="-k" +fi +if [[ $DPDK =~ "yes" ]]; then + setdpdk="-d" fi if [ -z $OVS_REPO_URL ]; then @@ -81,29 +107,24 @@ else echo Will use default kernel in ovs test vm fi -if [ -z ${WORKSPACE+1} ]; then - # We are not being run by Jenkins. - export WORKSPACE=$HOME/opnfv/ovsnfv - mkdir -p opnfv - cd opnfv - git clone https://git.opnfv.org/ovsnfv +if [ -z $TAG ]; then + TAG=master fi -export BUILD_BASE=$WORKSPACE/build - - +if [ ! -z $DPDK ]; then + setbuilddpdk="-d" +fi -if [ ! -d $BUILD_BASE ] -then - mkdir -p $BUILD_BASE +if [ -z ${WORKSPACE+1} ]; then + # We are not being run by Jenkins. + export WORKSPACE=`pwd` fi -if [ ! -f $BUILD_BASE/config ]; then - touch $BUILD_BASE/config +if [ -z ${BUILD_BASE+1} ]; then + export BUILD_BASE=$WORKSPACE fi -export PATH=$PATH:$WORKSPACE/ci:$BUILD_BASE -source $BUILD_BASE/config +export PATH=$PATH:$BUILD_BASE cd $BUILD_BASE export TOPDIR=$BUILD_BASE @@ -112,7 +133,7 @@ export TOPDIR=$BUILD_BASE export TMP_RELEASE_DIR=$TOPDIR/release export CACHE_DIR=$TOPDIR/cache -export TMPDIR=$TOPDIR/scratch +export TEMPDIR=$TOPDIR/scratch export RPMDIR=$TOPDIR/rpmbuild @@ -120,26 +141,52 @@ mkdir -p $RPMDIR/RPMS mkdir -p $RPMDIR/SOURCES mkdir -p $RPMDIR/SPECS mkdir -p $RPMDIR/SRPMS - - -if [ ! -z $TESTRPM ]; then - # Spawn VM to do the testing. - if [ ! -z $kernel_version ]; then - instack_ovs.sh -a $kernel_major -g $TAG -i $kernel_minor -p $OVS_PATCH -t -u $OVS_REPO_URL - else - instack_ovs.sh -g $TAG -p $OVS_PATCH -t -u $OVS_REPO_URL - fi -else - # Run build locally. - build_ovs_rpm.sh -d -g -p $OVS_PATCH -u $OVS_REPO_URL - cp $HOME/rpmbuild/RPMS/* $TMP_RELEASE_DIR +# +# build dpdk rpm locally. +# +if [[ "$DPDK" =~ "yes" ]]; then + echo "===============================" + echo Build DPDK RPMs + echo + $BUILD_BASE/build_dpdk_rpm.sh -g $DPDK_VERSION fi +# +# Build locally and copy RPMS +# +echo "===============================" +echo build OVS rpm locally +echo + ./build_ovs_rpm.sh $setnocheck -g $TAG $setdpdk $setkmod -p $OVS_PATCH -u $OVS_REPO_URL -echo "--------------------------------------------------" -echo "Build OVS RPM from upstream git $OVS_REPO_URL version $TAG" -if [ ! -z $OVS_PATCH ]; then - echo "Apply patches from: $OVS_PATCH" -fi +echo "===============================" +echo copy rpms to release dir +echo +cp $RPMDIR/RPMS/x86_64/*.rpm $TMP_RELEASE_DIR || true +rm $RPMDIR/RPMS/x86_64/*.rpm || true +cp $BUILD_BASE/rpms/*.rpm $TMP_RELEASE_DIR || true +cp $BUILD_BASE/ovsrpm/ovs/rpm/rpmbuild/RPMS/x86_64/*.rpm $TMP_RELEASE_DIR || true +cp $BUILD_BASE/ovsrpm/ovs/rpm/rpmbuild/RPMS/no_arch/*.rpm $TMP_RELEASE_DIR || true + +# +# Build OVS without DPDK, apply patches and build kmod. +# +setkmod="-k" +OVS_PATCH="yes" +setdpdk= + +echo "===================================================" +echo build OVS without DPDK, apply patches and build kmod. echo + ./build_ovs_rpm.sh $setnocheck -g $TAG $setdpdk $setkmod -p $OVS_PATCH -u $OVS_REPO_URL +echo "===============================" +echo copy rpms to release dir and add experimental tag +echo +cd $RPMDIR/RPMS/x86_64 +for i in `ls openvswitch*.rpm` +do + echo copying $i to $TMP_RELEASE_DIR/EXPERIMENTAL-$i + cp $i $TMP_RELEASE_DIR/EXPERIMENTAL-$i + echo +done exit 0