summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Stelmach <l.stelmach@samsung.com>2014-11-17 15:04:16 (GMT)
committerŁukasz Stelmach <l.stelmach@samsung.com>2014-11-19 12:28:48 (GMT)
commitfbc6e09ad29b2eac1b4ad4229cebd45c12d7301f (patch)
tree8bb466fbdc19f3ed151af4749aacc8fc3fc1aaff
parent9640d9fcf1587efe0ae79fe82f3bd8f230df38ac (diff)
downloadkdbus-bus-fbc6e09ad29b2eac1b4ad4229cebd45c12d7301f.zip
kdbus-bus-fbc6e09ad29b2eac1b4ad4229cebd45c12d7301f.tar.gz
kdbus-bus-fbc6e09ad29b2eac1b4ad4229cebd45c12d7301f.tar.bz2
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 <l.stelmach@samsung.com>
-rw-r--r--packaging/update_version.sh23
1 files changed, 23 insertions, 0 deletions
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