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>
--- /dev/null
+#!/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