From dd19303aa13d4fef01631117d0410fc6cb8b2c9b Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Tue, 23 Jul 2013 15:13:55 +0200 Subject: [PATCH] debian_wrap_maven_results.sh: calculate version using maven. only require one param, not three --- debian_wrap_maven_results.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/debian_wrap_maven_results.sh b/debian_wrap_maven_results.sh index 4d20968..30f57dc 100755 --- a/debian_wrap_maven_results.sh +++ b/debian_wrap_maven_results.sh @@ -1,8 +1,14 @@ #!/bin/bash DISTRIBUTION=$1 -VERSION=$2 -COMMENT=$3 +VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version | grep -v "^\[") # TODO: check for valid version? SCRIPTNAME=${0##*/} +VALID_DISTROS=("unstable" "wheezy" "squeeze") + +function containsElement () { + local e + for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done + return 1 +} function cleanup { echo cleaning up ... @@ -33,15 +39,16 @@ function failIfFailed function usage { - echo 'Usage:' ${SCRIPTNAME} ' ' + echo 'Usage:' ${SCRIPTNAME} '' exit $1 } function validateInput { - if [[ -z "${DISTRIBUTION}" ]] + + if ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; then - echo "Need to specify distribution" + echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS" usage 1 fi @@ -51,12 +58,6 @@ function validateInput usage 2 fi - if [[ -z "${COMMENT}" ]] - then - echo "Need to specify Comment" - usage 3 - fi - } function goUp @@ -69,7 +70,8 @@ goUp validateInput # change version in changelog -failIfFailed dch -D${DISTRIBUTION} -v ${VERSION} ${COMMENT} +# TODO: fix comment +failIfFailed dch -D${DISTRIBUTION} -v ${VERSION} "dummy comment" #build debian package -- 2.39.5