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/07/13 11:17:42 UTC

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

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 4a5fab0  packaging: Catch error in packaging script and fail the build (#2649)
4a5fab0 is described below

commit 4a5fab0573c6d99a79ef3c6cbcf30918c2465ff8
Author: Khosrow Moossavi <kh...@gmail.com>
AuthorDate: Fri Jul 13 07:17:34 2018 -0400

    packaging: Catch error in packaging script and fail the build (#2649)
    
    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. And also
    fail the build if something in the script has returned
    non-zero value.
---
 packaging/build-deb.sh | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/packaging/build-deb.sh b/packaging/build-deb.sh
index 52a168a..e8c1783 100755
--- a/packaging/build-deb.sh
+++ b/packaging/build-deb.sh
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#set -e
+set -e
 
 #
 # This script builds Debian packages for CloudStack and does
@@ -100,8 +100,7 @@ while [ -n "$1" ]; do
     esac
 done
 
-DCH=$(which dch)
-if [ -z "$DCH" ] ; then
+if [ -z "$(which dch)" ] ; then
     echo -e "dch not found, please install devscripts at first. \nDEB Build Failed"
     exit 1
 fi
@@ -110,6 +109,17 @@ NOW="$(date +%s)"
 PWD=$(cd $(dirname "$0") && pwd -P)
 cd $PWD/../
 
+# 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
+
 VERSION=$(head -n1 debian/changelog  |awk -F [\(\)] '{print $2}')
 DISTCODE=$(lsb_release -sc)
 
@@ -148,4 +158,6 @@ dpkg-buildpackage -uc -us -b
 
 /bin/mv /tmp/changelog.orig debian/changelog
 
-(cd $PWD; git reset --hard)
+if [ "$USE_TIMESTAMP" == "true" ]; then
+    (cd $PWD; git reset --hard)
+fi