From: Holger Levsen Date: Fri, 26 Jul 2013 10:59:06 +0000 (+0200) Subject: fix DISTRIBUTION replacement X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=2356501708ac7b62a9463d4b8e588cceb5339436;p=profitbricks%2Fjenkins-build-scripts.git fix DISTRIBUTION replacement --- diff --git a/maven_post_build_debian_wrapper.sh b/maven_post_build_debian_wrapper.sh index cc8bce9..ade8eba 100755 --- a/maven_post_build_debian_wrapper.sh +++ b/maven_post_build_debian_wrapper.sh @@ -78,23 +78,30 @@ set -x # echo commands executed if [ "$GIT_BRANCH_NAME" = "master" ] || [ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ] ; then # generate debian/changelog entries since the last upload git-dch -a --ignore-branch --no-full --no-meta --id-length=7 -N $VERSION - sed -i "0,/UNRELEASED/s//$DISTRIBUTION/" debian/changelog + # make sure distribution in changelog is set correctly + # (read the comments for the sed command 5 lines below to understand this) + sed -i "0,/).*\$/s//) $DISTRIBUTION; urgency=low/" debian/changelog else # change version in changelog dch -i --no-auto-nmu "Generated by jenkins" git-dch -a --ignore-branch --no-full --no-meta --id-length=7 - # replace first version (enclosed in brackets) with real version - # we cannot use (git-)dch as the version might be lower than the last - sed -i "0,/(.*)/s//($VERSION)/" debian/changelog - # replace first UNRELEASED with $DISTRIBUTION - sed -i "0,/UNRELEASED/s//$DISTRIBUTION/" debian/changelog + # replace first occurance of a version (enclosed in brackets) with real version + # (we cannot use (git-)dch as the version might be lower than the last), + # and also set distribution here. + # sed explained: look for the first occurance of (.*).*$ - so thats something + # in brackets until the end of the line. = first line of a debian/changelog + sed -i "0,/(.*).*\$/s//($VERSION) $DISTRIBUTION; urgency=low/" debian/changelog +fi +# check that we replaced things correctly... +D=$(dpkg-parsechangelog 2>/dev/null|grep ^Distribution:|cut -d " " -f2) +if [ "$D" != "$DISTRIBUTION" ] ; then + figlet "Wrong distribution!" + dpkg-parsechangelog + exit 1 fi -head -1 debian/changelog - # build debian package (just binary, no source package) dpkg-buildpackage -us -uc -b -head -1 debian/changelog # upload to reprepro CHANGES_FILE=${SOURCE}_${VERSION}_amd64.changes