# it updates debian/changelog, builds the debian package(s) and uploads to our repo.
#
-DISTRIBUTION=$1 # we cannot derive the distro from the branch as there is wheezy+squeeze, so this has to come from the job definition
+SUITE=$1 # this has to be either squeeze or wheezy currently
VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[")
-VALID_DISTROS=("unstable" "wheezy" "squeeze" "production" \
- "production-proposed-updates" "pre-staging" "staging")
-SPECIAL_BRANCHES=("feature/" "hotfix/" "poc/" "integration")
-REPO=pb-squeeze
-
-function containsElement () {
- local e
- for e in "${@:2}"; do [[ "$e" = "$1" ]] && return 0; done
- return 1
-}
+FEATURE_BRANCHES=("feature/" "poc/" "integration")
+REPO=pb-${SUITE}
function startswithElement () {
local e
echo cleaup done
}
-function validateInput
+function validateSettings
{
APPEND_TO_VERSION=""
exit 1
fi
- if startswithElement $GIT_BRANCH_NAME "${SPECIAL_BRANCHES[@]}" ; then
+ if startswithElement $GIT_BRANCH_NAME "${FEATURE_BRANCHES[@]}" ; then
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-squeeze"
+ REPO="dev-${SUITE}"
APPEND_TO_VERSION="experimental"
- elif ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" || [ -z "$DISTRIBUTION" ] ; then
- echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS"
- exit 1
- if [ "$DISTRIBUTION" = "unstable" ] || [ "$DISTRIBUTION" = "pre-staging" ] ; then
- APPEND_TO_VERSION="develop"
- fi
+ elif [ "$GIT_BRANCH_NAME" = "master" ] || [ ${GIT_BRANCH_NAME:0:7} = "hotfix/" ]
+ DISTRIBUTION="production-proposed-updates"
+ else
+ DISTRIBUTION="unstable"
+ APPEND_TO_VERSION="develop"
fi
if [ ! -z "$APPEND_TO_VERSION" ] ; then
VERSION=$(echo $VERSION | sed -s "s#-SNAPSHOT##g")
BUILD_START=$(date +%Y%m%d%H%M%S)
VERSION="${VERSION}~${APPEND_TO_VERSION}${BUILD_START}+${BUILD_NUMBER}+g${GIT_COMMIT:0:7}"
- SOURCE=$(dpkg-parsechangelog 2>/dev/null|grep ^Source:|cut -d " " -f2) # get the name of the source package
- echo "Ahout to start to build the debian packages:"
- echo "============================================"
- echo "$SOURCE $VERSION"
- echo "============================================"
fi
+
+ SOURCE=$(dpkg-parsechangelog 2>/dev/null|grep ^Source:|cut -d " " -f2) # get the name of the source package
+ echo "Ahout to start to build the debian packages:"
+ echo "============================================"
+ echo "$SOURCE $VERSION"
+ echo "============================================"
}
#############
# MAIN
#############
cd $WORKSPACE
-validateInput
+validateSettings
export
set -e # fail on error
set -x # echo commands executed