summaryrefslogtreecommitdiff
path: root/other/version-sync
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-23 23:34:16 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-28 23:29:36 +0100
commit36f40f1a4f9041c138cc38460cb8e93d904131bd (patch)
tree87ce5cc8528337ca75a82402fe61d154c6b66aff /other/version-sync
parent51139a080c982a6460aa25975b3a1e0866f518ed (diff)
Add version-sync script to update all places with versions.
This will update tox.in.h only. Currently, you will still need to manually update tox.h. An upcoming PR (#154) will update tox.h as part of the build.
Diffstat (limited to 'other/version-sync')
-rwxr-xr-xother/version-sync28
1 files changed, 28 insertions, 0 deletions
diff --git a/other/version-sync b/other/version-sync
new file mode 100755
index 00000000..642e8177
--- /dev/null
+++ b/other/version-sync
@@ -0,0 +1,28 @@
1#!/bin/sh
2
3set -eu
4
5SOURCE_DIR=$1
6MAJOR=$2
7MINOR=$3
8PATCH=$4
9
10VER="$MAJOR.$MINOR.$PATCH"
11
12update() {
13 file="$SOURCE_DIR/$1"
14 expr="$2"
15
16 sed -e "$expr" "$file" > "$file.updated-version"
17 if diff "$file" "$file.updated-version"; then
18 rm "$file.updated-version"
19 else
20 mv "$file.updated-version" "$file"
21 fi
22}
23
24update "configure.ac" 's/AC_INIT(\[tox\], \[.*\])/AC_INIT([tox], ['$VER'])/'
25
26update "other/apidsl/tox.in.h" 's/\(const VERSION_MAJOR *= \).*;/\1'$MAJOR';/'
27update "other/apidsl/tox.in.h" 's/\(const VERSION_MINOR *= \).*;/\1'$MINOR';/'
28update "other/apidsl/tox.in.h" 's/\(const VERSION_PATCH *= \).*;/\1'$PATCH';/'