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