updated packge scripts to support simularot rpm build

(cherry picked from commit f96c65416a2802bcf2a1f8d5a5070ffe6a29111f)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dfdf9edd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dfdf9edd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dfdf9edd

Branch: refs/heads/master
Commit: dfdf9edd529eae6169379986dd886df3e982b4a0
Parents: eb447f1
Author: rayeesn <raye...@citrix.com>
Authored: Thu Sep 18 15:02:35 2014 -0700
Committer: David Nalley <da...@gnsa.us>
Committed: Mon Oct 13 00:35:31 2014 -0400

----------------------------------------------------------------------
 packaging/centos63/cloud.spec | 21 ++++++++++++++++-----
 packaging/centos63/package.sh | 24 +++++++++++++++++++++---
 2 files changed, 37 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfdf9edd/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index 7306d1f..e977e34 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -206,12 +206,23 @@ touch build/gitrev.txt
 echo $(git rev-parse HEAD) > build/gitrev.txt
 
 if [ "%{_ossnoss}" == "NOREDIST" -o "%{_ossnoss}" == "noredist" ] ; then
-   echo "Executing mvn packaging with non-redistributable libraries ..."
-   mvn -Pawsapi,systemvm -Dnoredist clean package
+   echo "Executing mvn packaging with non-redistributable libraries"
+   if [ "%{_sim}" == "SIMULATOR" -o "%{_sim}" == "simulator" ] ; then 
+      echo "Executing mvn noredist packaging with simulator ..."
+      mvn -Pawsapi,systemvm -Dnoredist -Dsimulator clean package 
+   else
+      echo "Executing mvn noredist packaging without simulator..."
+      mvn -Pawsapi,systemvm -Dnoredist clean package
+   fi
 else
-   echo "Executing mvn packaging ..."
-   mvn -Pawsapi,systemvm clean package
-fi
+   if [ "%{_sim}" == "SIMULATOR" -o "%{_sim}" == "simulator" ] ; then 
+      echo "Executing mvn default packaging simulator ..."
+      mvn -Pawsapi,systemvm -Dsimulator clean package 
+   else
+      echo "Executing mvn default packaging without simulator ..."
+      mvn -Pawsapi,systemvm clean package
+   fi
+fi 
 
 %install
 [ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfdf9edd/packaging/centos63/package.sh
----------------------------------------------------------------------
diff --git a/packaging/centos63/package.sh b/packaging/centos63/package.sh
index 6a2d168..bbc3736 100755
--- a/packaging/centos63/package.sh
+++ b/packaging/centos63/package.sh
@@ -25,6 +25,7 @@ function usage() {
     echo "-p|--pack noredist|NOREDIST   To package with non-redistributable 
libraries"
     echo "-o default|DEFAULT            To build in default Operating System 
mode"
     echo "-o rhel7|RHEL7                To build for rhel7"
+    echo "-s simulator|SIMULATOR        To build for Simulator"
     echo ""
     echo "Examples: ./package.sh -p|--pack oss|OSS"
     echo "          ./package.sh -p|--pack noredist|NOREDIST"
@@ -44,6 +45,10 @@ function packaging() {
         DEFOSSNOSS="-D_ossnoss $2"
         echo "$DEFOSSNOSS"
     fi
+    if [ -n "$3" ] ; then
+        DEFSIM="-D_sim $3"
+        echo "$DEFSIM"
+    fi
 
     VERSION=`(cd ../../; mvn 
org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate 
-Dexpression=project.version) | grep --color=none '^[0-9]\.'`
     if echo $VERSION | grep -q SNAPSHOT ; then
@@ -90,7 +95,7 @@ if [ $# -lt 1 ] ; then
     packaging "default"
 elif [ $# -gt 0 ] ; then
     SHORTOPTS="hp:o:"
-    LONGOPTS="help,pack:,operating-system:"
+    LONGOPTS="help,pack:,operating-system:,simulator:"
     ARGS=$(getopt -s bash -u -a --options $SHORTOPTS  --longoptions $LONGOPTS 
--name $0 -- "$@")
     eval set -- "$ARGS"
     echo "$ARGS"
@@ -127,6 +132,19 @@ elif [ $# -gt 0 ] ; then
             fi
             shift
             ;;
+        -s | --simulator)
+            sim=$2
+            echo "$sim"
+            if [ "$sim" == "default" -o "$sim" == "DEFAULT" ] ; then
+                sim = "false"
+            elif [ "$sim" == "simulator" -o "$sim" == "SIMULATOR" ] ; then
+                sim="simulator"
+            else
+                echo "Error: Incorrect value provided in package.sh script for 
-o, Please see help ./package.sh --help|-h for more details."
+               exit 1
+            fi
+            shift
+            ;;
         -)
             echo "Unrecognized option..."
             usage
@@ -142,8 +160,8 @@ elif [ $# -gt 0 ] ; then
         echo "Setting os to default"
         os="default"
     fi
-    echo "Passed OS = $os and packageval = $packageval"
-    packaging $os $packageval
+    echo "Passed OS = $os, packageval = $packageval and Simulator build = $sim"
+    packaging $os $packageval $sim
 else
     echo "Incorrect choice.  Nothing to do." >&2
     echo "Please, execute ./package.sh --help for more help"

Reply via email to