DISTRIBUTION=$1
VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version | grep -v "^\[")
SCRIPTNAME=${0##*/}
-VALID_DISTROS=("unstable" "wheezy" "squeeze")
+VALID_DISTROS=("unstable" "wheezy" "squeeze" "production" \
+ "production-proposed-updates" "pre-staging" "staging" "experimental")
+SPECIAL_BRANCHES=("feature/" "hotfix/" "poc/")
function containsElement () {
local e
- for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
+ for e in "${@:2}"; do [[ "$e" = "$1" ]] && return 0; done
+ return 1
+}
+
+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 validateInput
{
+ if startswithElement $GIT_BRANCH_NAME "${SPECIAL_BRANCHES[@]}" ; then
+ DISTRIBUTION="experimental"
+ fi
if ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; then
echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS"
set -x # echo commands executed
# change version in changelog
-git-dch -a --ignore-branch --new-version=${VERSION}
+git-dch -a --ignore-branch
# we now what we're doing and we don't want an editor.….
-echo | EDITOR=true dch -D ${DISTRIBUTION} -r --no-force-save-on-release -b
+echo | EDITOR=true dch -D ${DISTRIBUTION} --newversion ${VERSION} --no-force-save-on-release --force-distribution --force-bad-version
-#build debian package (just binary, no sources)
+# build debian package (just binary, no source package)
dpkg-buildpackage -us -uc -b
# push back to git repo