From 48e9959c8d087fbbaa5447d8cbdf1793a2806573 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 24 Jul 2013 14:21:21 +0200 Subject: [PATCH] commit debian/changelog if applicable and set correct distro for feature branches --- debian_wrap_maven_results.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/debian_wrap_maven_results.sh b/debian_wrap_maven_results.sh index 1ac6cf7..d1b7296 100755 --- a/debian_wrap_maven_results.sh +++ b/debian_wrap_maven_results.sh @@ -1,10 +1,9 @@ #!/bin/bash DISTRIBUTION=$1 VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version | grep -v "^\[") -SCRIPTNAME=${0##*/} VALID_DISTROS=("unstable" "wheezy" "squeeze" "production" \ "production-proposed-updates" "pre-staging" "staging" "experimental") -SPECIAL_BRANCHES=("feature/" "hotfix/" "poc/") +SPECIAL_BRANCHES=("feature/" "hotfix/" "poc/" "integration") function containsElement () { local e @@ -15,8 +14,7 @@ function containsElement () { function startswithElement () { local e local l - for e in "${@:2}"; - do + 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 @@ -36,7 +34,11 @@ function cleanup { function validateInput { if startswithElement $GIT_BRANCH_NAME "${SPECIAL_BRANCHES[@]}" ; then - DISTRIBUTION="experimental" + if [ "$GIT_BRANCH_NAME" = "integration" ] ; then + DISTRIBUTION="unstable" + else + DISTRIBUTION="experimental" + if fi if ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; then @@ -45,15 +47,15 @@ function validateInput fi if [ "$DISTRIBUTION" = "experimental" ] ; then - # TODO - echo TODO set DISTRIBUTION correctly + # set proper DISTRIBUTION for feature branches + DISTRIBUTION= $(echo "dev-${GIT_BRANCH_NAME}" | tr '/' '-') fi - if [[ -z "${VERSION}" ]] - then + if [[ -z "${VERSION}" ]] ; then echo "Need to specify version" exit 1 fi + # TODO: we need to do better VERSION=$(echo $VERSION | sed -s "s#SNAP#0SNAP#g") echo "==================================" @@ -77,11 +79,12 @@ echo | EDITOR=true dch -D ${DISTRIBUTION} --newversion ${VERSION} --no-force-sav # build debian package (just binary, no source package) dpkg-buildpackage -us -uc -b -# push back to git repo -if [ "$GIT_BRANCH_NAME" = "master" ] ; then - # TODO: git commit +# push back to git repo if build from master or hotfix/ +if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ] ; then + git add debian/changelog + git commit -m "Automatic commit by jenkins after build of $BUILD_NUMBER" # TODO: git tag - # TODO: git push + git push origin $GIT_BRANCH_NAME fi # upload to reprepro -- 2.39.5