From: Holger Levsen Date: Thu, 25 Jul 2013 15:04:41 +0000 (+0200) Subject: refactoring X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=46ce6684b449a9a758d9993ed12f3dd2f52e5145;p=profitbricks%2Fjenkins-build-scripts.git refactoring --- diff --git a/maven_post_build_debian_wrapper.sh b/maven_post_build_debian_wrapper.sh index b0bf657..ea00024 100755 --- a/maven_post_build_debian_wrapper.sh +++ b/maven_post_build_debian_wrapper.sh @@ -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