summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-09-21 13:51:18 +0100
committerPete Batard <pbatard@gmail.com>2010-09-21 13:51:18 +0100
commit73a263bf205f1aae67ef21b03f9deea1815cc695 (patch)
treed57049bb0e99be8e7d2cfb0fc175f8b98db69a3b
parent0c3fdebd60230a95188d687ee46cff788e303072 (diff)
downloadlibusb-73a263bf205f1aae67ef21b03f9deea1815cc695.tar.gz
[INTERNAL - NOT FOR RELEASE] added bump.sh script
-rw-r--r--bump.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/bump.sh b/bump.sh
new file mode 100644
index 0000000..70f0582
--- /dev/null
+++ b/bump.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# This script bumps the version and updates the git tree accordingly, with tag
+
+type -P sed &>/dev/null || { echo "sed command not found. Aborting." >&2; exit 1; }
+type -P git &>/dev/null || { echo "git command not found. Aborting." >&2; exit 1; }
+
+if [ ! -n "$1" ]; then
+ TAG=$(git describe --tags --abbrev=0 2>/dev/null)
+ if [ ! -n "$TAG" ]; then
+ echo Unable to read tag - aborting.
+ exit 1
+ fi
+else
+ TAG=$1
+fi
+if [ ! ${TAG:0:3} = 'pbr' ]; then
+ echo Tag "$TAG" does not start with 'pbr' - aborting
+ exit 1
+fi
+TAGVER=${TAG:3}
+OFFSET=10000
+# increment - ideally, we'd check that tagver is really numeric here
+TAGVER=`expr $TAGVER + 1`
+TAGVER_OFF=`expr $TAGVER + $OFFSET`
+echo "Bumping version to pbr$TAGVER (nano: $TAGVER_OFF)"
+sed -e "s/\(^m4_define(LIBUSB_NANO.*\)/m4_define(LIBUSB_NANO, [$TAGVER_OFF])/" configure.ac >> configure.ac~
+mv configure.ac~ configure.ac
+# we're duplicating libusb_version.h generation here, but that avoids having to run configure
+sed -e "s/\(^#define LIBUSB_VERSION_NANO.*\)/#define LIBUSB_VERSION_NANO $TAGVER_OFF/" \
+ -e "s/^#define LIBUSB_PACKAGE_VERSION[[:blank:]]\"\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.[0-9]*\"/#define LIBUSB_PACKAGE_VERSION \"\1.\2.\3.$TAGVER_OFF\"/" \
+ libusb/libusb_version.h > libusb/libusb_version.h~
+mv libusb/libusb_version.h~ libusb/libusb_version.h
+git commit -a -m "bumped internal version"
+git tag "pbr$TAGVER" \ No newline at end of file