]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
refactoring
authorHolger Levsen <holger@layer-acht.org>
Thu, 25 Jul 2013 15:04:41 +0000 (17:04 +0200)
committerHolger Levsen <holger@layer-acht.org>
Thu, 25 Jul 2013 15:04:41 +0000 (17:04 +0200)
maven_post_build_debian_wrapper.sh

index b0bf657034b02f2f31107952cd86da34d11253ce..ea000243992d35717ad79e6391327dbb4c243c85 100755 (executable)
@@ -9,26 +9,6 @@
 # it updates debian/changelog, builds the debian package(s) and uploads to our repo.
 #
 
-SUITE=$1               # this has to be either squeeze or wheezy currently
-if [[ -z "${SUITE}" ]] ; then
-        SUITE="squeeze"
-       echo "Warning: SUITE not definied, defaulting to \"squeeze\"."
-fi
-VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[")
-FEATURE_BRANCHES=("feature/" "poc/" "integration")
-REPO=pb-${SUITE}
-
-function startswithElement () {
-  local e
-  local l
-  for e in "${@:2}"; do
-                l=${#e}   # length of the element
-               # test if element equals $1 with the length of element:
-               [[ "$e" = "${1:0:$l}" ]] && return 0
-  done
-  return 1
-}
-
 function cleanup {
     echo cleaning up ...
     # revert changelog changes
@@ -40,24 +20,25 @@ function cleanup {
 
 function validateSettings
 {
-    APPEND_TO_VERSION=""
-
+    REPO=pb-${SUITE}
+    VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[")
     if [[ -z "${VERSION}" ]] ; then
         echo "ERROR: Cannot get version from maven using 'mvn -B -N help:evaluate -Dexpression=project.version'"
        mvn -B -N help:evaluate -Dexpression=project.version
         exit 1
     fi
 
-    if startswithElement $GIT_BRANCH_NAME "${FEATURE_BRANCHES[@]}" ; then
+    if [ "$GIT_BRANCH_NAME" = "integration" ] || [ ${GIT_BRANCH_NAME:0:8} = "feature/" ] || [ ${GIT_BRANCH_NAME:0:3} = "poc/" ]; then
+       APPEND_TO_VERSION="experimental"
+       REPO="dev-${SUITE}"
        if [ "$GIT_BRANCH_NAME" = "integration" ] ; then
                DISTRIBUTION="dev-integration"
        else
                # set proper DISTRIBUTION for feature branches
                DISTRIBUTION=$(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-')
        fi
-       REPO="dev-${SUITE}"
-       APPEND_TO_VERSION="experimental"
     elif [ "$GIT_BRANCH_NAME" = "master" ] || [ ${GIT_BRANCH_NAME:0:7} = "hotfix/" ] ; then
+        APPEND_TO_VERSION=""
        DISTRIBUTION="production-proposed-updates"
     else
        DISTRIBUTION="unstable"
@@ -81,6 +62,12 @@ function validateSettings
 #############
 # MAIN
 #############
+
+SUITE=$1               # this has to be either squeeze or wheezy currently
+if [[ -z "${SUITE}" ]] ; then
+        SUITE="squeeze"
+       echo "Warning: SUITE not defined, defaulting to \"squeeze\"."
+fi
 cd $WORKSPACE
 validateSettings
 export