You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/05/09 16:13:13 UTC

[cloudstack] branch master updated: packaging: Catch error in packaging script and fail the build (#2627)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 1107595  packaging: Catch error in packaging script and fail the build (#2627)
1107595 is described below

commit 11075953f66c3ed0adc457a08601833b5395e581
Author: Khosrow Moossavi <kh...@gmail.com>
AuthorDate: Wed May 9 12:13:07 2018 -0400

    packaging: Catch error in packaging script and fail the build (#2627)
    
    This is to fix the regression added in #2433. In this fix
    we're going to fail the build early if --use-timestamp is
    provided and working directory is *not* clean.
---
 packaging/package.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/packaging/package.sh b/packaging/package.sh
index c4f2c48..7432da7 100755
--- a/packaging/package.sh
+++ b/packaging/package.sh
@@ -162,11 +162,16 @@ function packaging() {
     cp "$PWD/$DISTRO/cloud.spec" "$RPMDIR/SPECS"
 
     (cd "$RPMDIR"; rpmbuild --define "_topdir ${RPMDIR}" "${DEFVER}" "${DEFFULLVER}" "${DEFREL}" ${DEFPRE+"$DEFPRE"} ${DEFOSSNOSS+"$DEFOSSNOSS"} ${DEFSIM+"$DEFSIM"} -bb SPECS/cloud.spec)
-    (cd $PWD/../; git reset --hard)
     if [ $? -ne 0 ]; then
+        if [ "$USE_TIMESTAMP" == "true" ]; then
+            (cd $PWD/../; git reset --hard)
+        fi
         echo "RPM Build Failed "
         exit 3
     else
+        if [ "$USE_TIMESTAMP" == "true" ]; then
+            (cd $PWD/../; git reset --hard)
+        fi
         echo "RPM Build Done"
     fi
     exit
@@ -259,5 +264,16 @@ if [ -n "$unrecognized_flags" ]; then
     echo ""
 fi
 
+# Fail early if working directory is NOT clean and --use-timestamp was provided
+if [ "$USE_TIMESTAMP" == "true" ]; then
+    if [ -n "$(cd $PWD/../; git status -s)" ]; then
+        echo "Erro: You have uncommitted changes and asked for --use-timestamp to be used."
+        echo "      --use-timestamp flag is going to temporarily change  POM versions  and"
+        echo "      revert them at the end of build, and there's no  way we can do partial"
+        echo "      revert. Please commit your changes first or omit --use-timestamp flag."
+        exit 1
+    fi
+fi
+
 echo "Packaging CloudStack..."
 packaging "$PACKAGEVAL" "$SIM" "$TARGETDISTRO" "$RELEASE" "$BRANDING" "$USE_TIMESTAMP"

-- 
To stop receiving notification emails like this one, please contact
rohit@apache.org.