From 9f3a505c854df73b8d2edad8047c9c8a428a6e8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Mon, 17 Nov 2014 16:04:16 +0100 Subject: [PATCH] Add a script to update Version automatically MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- packaging/update_version.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packaging/update_version.sh 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 -- 2.34.1