From: Łukasz Stelmach Date: Mon, 17 Nov 2014 15:04:16 +0000 (+0100) Subject: Add a script to update Version automatically X-Git-Tag: submit/kdbus-integration/20141211.130918~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f3a505c854df73b8d2edad8047c9c8a428a6e8d;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git Add a script to update Version automatically The script derives the package version from the upstream commit used as a base for the package release. Proper upstream/ tag is also created. Change-Id: I66987c225bb4a994c0312f4cf6a3f537cd8130f0 Signed-off-by: Łukasz Stelmach --- diff --git a/packaging/update_version.sh b/packaging/update_version.sh new file mode 100644 index 0000000..4a8a6cc --- /dev/null +++ b/packaging/update_version.sh @@ -0,0 +1,23 @@ +#!/bin/sh +export TZ=UTC LANG=C +cd $(dirname $0) + +upstream_base=$(git merge-base HEAD upstream/master) +upstream_date=$(date +%Y%m%d.%H%M%S --date=@$(git log -1 --format=%at ${upstream_base})) +upstream_short=$(git log -1 --format=%h ${upstream_base}) +KDBUS_VERSION=0.${upstream_date}utc + +if ! git tag -l upstream/* | grep ${KDBUS_VERSION}; then + git tag upstream/${KDBUS_VERSION} ${upstream_base} +fi + +git stash +if grep -q '^Version: \+'${KDBUS_VERSION} kdbus.spec; then + echo Package version is up to date. + git stash pop + exit 0; +fi + +sed -i -e "1,/^Version: \+/s/^Version: \+[0-9].*/Version: ${KDBUS_VERSION}/" kdbus.spec +git commit -sam "Bump version to ${KDBUS_VERSION}" +git stash pop