From 835d73bf3c8e619edff9f7fb3754de66ec27c954 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Tue, 23 Jul 2013 19:02:38 +0200 Subject: [PATCH] debian_wrap_maven_results.sh: write proper changelog --- debian_wrap_maven_results.sh | 78 +++++++++++++++++------------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/debian_wrap_maven_results.sh b/debian_wrap_maven_results.sh index 30f57dc..3f99fd1 100755 --- a/debian_wrap_maven_results.sh +++ b/debian_wrap_maven_results.sh @@ -1,6 +1,6 @@ #!/bin/bash DISTRIBUTION=$1 -VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version | grep -v "^\[") # TODO: check for valid version? +VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version | grep -v "^\[") SCRIPTNAME=${0##*/} VALID_DISTROS=("unstable" "wheezy" "squeeze") @@ -12,73 +12,69 @@ function containsElement () { function cleanup { echo cleaning up ... - # revert changelog changes git checkout -- debian/changelog - # remove files created by debian build git clean -fd debian - echo cleaup done } -function failIfFailed -{ - echo executing: \'$@\' ... - $@ - RET_CODE=$? - if [[ "${RET_CODE}" != "0" ]] - then - echo command \'$@\' failed - cleanup - exit 4 - - fi - echo done -} - -function usage -{ - echo 'Usage:' ${SCRIPTNAME} '' - exit $1 -} - function validateInput { - if ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; - then + if ! containsElement $DISTRIBUTION "${VALID_DISTROS[@]}" ; then echo "\$DISTRIBUTION is set to $DISTRIBUTION but thats not a valid distribution, which are: $VALID_DISTROS" - usage 1 + exit 1 + fi + + if [ "$DISTRIBUTION" = "experimental" ] ; then + # TODO + echo TODO set DISTRIBUTION correctly fi if [[ -z "${VERSION}" ]] then echo "Need to specify version" - usage 2 + exit 1 fi - + # TODO: we need to do better + VERSION=$(echo $VERSION | sed -s "s#SNAP#0SNAP#g") + echo "==================================" + echo $VERSION + echo "==================================" } -function goUp -{ - cd .. -} - -goUp - +############# +# MAIN +############# +cd $WORKSPACE validateInput +set -e # fail on error +set -x # echo commands executed # change version in changelog -# TODO: fix comment -failIfFailed dch -D${DISTRIBUTION} -v ${VERSION} "dummy comment" +git-dch -a --ignore-branch --new-version=${VERSION} +# 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 +#build debian package (just binary, no sources) +dpkg-buildpackage -us -uc -b -#build debian package -failIfFailed dpkg-buildpackage -us -uc +# push back to git repo +if [ "$GIT_BRANCH_NAME" = "master" ] ; then + # TODO: git commit + # TODO: git tag + # TODO: git push +fi # upload to reprepro # TODO: implement +# show the changelog +dpkg-parsechangelog + +set +x cleanup +#TODO: remove this debug output +export -- 2.39.5