aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-08-27 12:28:37 +0900
committerDrew DeVault <sir@cmpwn.com>2019-08-27 12:28:37 +0900
commitbd6b348feb0da72b74a0d19528ec00506a873058 (patch)
tree707202ffc6196cff8b5c009a97fdfc8aa05705e3
parentcdfe836b03e975d47592e3491be9582949d8bd19 (diff)
Add _incr_version to contrib/
-rwxr-xr-xcontrib/_incr_version33
1 files changed, 33 insertions, 0 deletions
diff --git a/contrib/_incr_version b/contrib/_incr_version
new file mode 100755
index 00000000..376be44c
--- /dev/null
+++ b/contrib/_incr_version
@@ -0,0 +1,33 @@
+#!/bin/sh -eu
+old_version="$1"
+new_version="$2"
+sed -i meson.build -e "s/version: '$old_version'/version: '$new_version'/g"
+
+printf "Backwards-incompatible ABI changes? (y/n) "
+read inc_age
+if [ "$inc_age" = 'n' ]
+then
+ printf "Interface(s) added, removed, or changed? (y/n) "
+ read inc_current
+fi
+
+so_version=$(egrep '^so_version =' meson.build | cut -d'[' -f2- | cut -d']' -f1)
+current=$(echo "$so_version" | cut -d',' -f1 | sed -e "s/'//g" -e "s/ //g")
+revision=$(echo "$so_version" | cut -d',' -f2 | sed -e "s/'//g" -e "s/ //g")
+age=$(echo "$so_version" | cut -d',' -f3 | sed -e "s/'//g" -e "s/ //g")
+
+if [ "$inc_age" = 'y' ]
+then
+ age=$((age+1))
+ current=$((current+1))
+elif [ "$inc_current" = 'y' ]
+then
+ current=$((current+1))
+fi
+revision=$((revision+1))
+
+sed -i meson.build \
+ -e "s/so_version = .*/so_version = ['$current', '$revision', '$age']/g"
+
+git add meson.build
+git commit -m "Update version to $new_version"