Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Add _incr_version to contrib/
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevault committed Aug 27, 2019
1 parent cdfe836 commit bd6b348
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions contrib/_incr_version
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit bd6b348

Please sign in to comment.