Skip to content

Commit cd39ecc

Browse files
committed
chore: Add version update script compatible with ci-tools.
1 parent 199878f commit cd39ecc

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

Diff for: other/bootstrap_daemon/docker/tox-bootstrapd.sha256

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9ec2993a28988bd147bf8f4f21a824c2fc5dbf7255e391b3ce517d337ebce5c1 /usr/local/bin/tox-bootstrapd
1+
1b91d7fbd6da34b92d1ad85b289a00909e211203ffd8541ae5c0887dcc35f920 /usr/local/bin/tox-bootstrapd

Diff for: other/version-sync

+18-18
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ update() {
1313
file="$SOURCE_DIR/$1"
1414
expr="$2"
1515

16-
sed -e "$expr" "$file" > "$file.updated-version"
16+
sed -e "$expr" "$file" >"$file.updated-version"
1717
if diff "$file" "$file.updated-version"; then
1818
rm "$file.updated-version"
1919
else
2020
# use cat > and rm instead of move to keep file permissions
21-
cat "$file.updated-version" > "$file"
21+
cat "$file.updated-version" >"$file"
2222
rm "$file.updated-version"
2323
fi
2424
}
2525

26-
update 'configure.ac' 's/AC_INIT(\[tox\], \[.*\])/AC_INIT([tox], ['$VER'])/'
26+
update 'configure.ac' 's/AC_INIT(\[tox\], \[.*\])/AC_INIT([tox], ['"$VER"'])/'
2727

28-
update 'toxcore/tox.api.h' 's/\(const VERSION_MAJOR *= \).*;/\1'$MAJOR';/'
29-
update 'toxcore/tox.api.h' 's/\(const VERSION_MINOR *= \).*;/\1'$MINOR';/'
30-
update 'toxcore/tox.api.h' 's/\(const VERSION_PATCH *= \).*;/\1'$PATCH';/'
28+
update 'toxcore/tox.api.h' 's/\(const VERSION_MAJOR *= \).*;/\1'"$MAJOR"';/'
29+
update 'toxcore/tox.api.h' 's/\(const VERSION_MINOR *= \).*;/\1'"$MINOR"';/'
30+
update 'toxcore/tox.api.h' 's/\(const VERSION_PATCH *= \).*;/\1'"$PATCH"';/'
3131

32-
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MAJOR "\).*"/\1'$MAJOR'"/'
33-
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MINOR "\).*"/\1'$MINOR'"/'
34-
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_PATCH "\).*"/\1'$PATCH'"/'
32+
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MAJOR "\).*"/\1'"$MAJOR"'"/'
33+
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MINOR "\).*"/\1'"$MINOR"'"/'
34+
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_PATCH "\).*"/\1'"$PATCH"'"/'
3535

3636
#
3737
# calculating the SO version
@@ -64,14 +64,14 @@ update 'CMakeLists.txt' 's/\(PROJECT_VERSION_PATCH "\).*"/\1'$PATCH'"/'
6464
# this must be constant starting from the 1.0 release
6565
LAST_SOMAJOR=2
6666

67-
if [ $MAJOR -eq 0 ]; then
67+
if [ "$MAJOR" -eq 0 ]; then
6868
SOMAJOR=$MINOR
6969
SOMINOR=$PATCH
7070

7171
# update lastmajor above
72-
update 'other/version-sync' 's/^\(LAST_SOMAJOR=\).*/\1'$SOMAJOR'/'
72+
update 'other/version-sync' 's/^\(LAST_SOMAJOR=\).*/\1'"$SOMAJOR"'/'
7373
else
74-
SOMAJOR=$(expr $MAJOR + $LAST_SOMAJOR)
74+
SOMAJOR=$(expr "$MAJOR" + "$LAST_SOMAJOR")
7575
SOMINOR=$MINOR
7676
fi
7777

@@ -115,16 +115,16 @@ fi
115115
# <=> major.minor.patch
116116
#
117117

118-
if [ $MAJOR -eq 0 ]; then
119-
LIBTOOL_CURRENT=$(expr $SOMAJOR + $SOMINOR)
118+
if [ "$MAJOR" -eq 0 ]; then
119+
LIBTOOL_CURRENT=$(expr "$SOMAJOR" + "$SOMINOR")
120120
LIBTOOL_AGE=$SOMINOR
121121
LIBTOOL_REVISION=0
122122
else
123-
LIBTOOL_CURRENT=$(expr $SOMAJOR + $SOMINOR)
123+
LIBTOOL_CURRENT=$(expr "$SOMAJOR" + "$SOMINOR")
124124
LIBTOOL_AGE=$SOMINOR
125125
LIBTOOL_REVISION=$PATCH
126126
fi
127127

128-
update 'so.version' 's/^\(CURRENT=\).*/\1'$LIBTOOL_CURRENT'/'
129-
update 'so.version' 's/^\(AGE=\).*/\1'$LIBTOOL_AGE'/'
130-
update 'so.version' 's/^\(REVISION=\).*/\1'$LIBTOOL_REVISION'/'
128+
update 'so.version' 's/^\(CURRENT=\).*/\1'"$LIBTOOL_CURRENT"'/'
129+
update 'so.version' 's/^\(AGE=\).*/\1'"$LIBTOOL_AGE"'/'
130+
update 'so.version' 's/^\(REVISION=\).*/\1'"$LIBTOOL_REVISION"'/'

Diff for: tools/update-versions.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux -o pipefail
4+
5+
VERSION=$1
6+
7+
GIT_ROOT=$(git rev-parse --show-toplevel)
8+
cd "$GIT_ROOT"
9+
10+
# Strip suffixes (e.g. "-rc.1") from the version for the toxcore version sync.
11+
VERSION="${VERSION%-*}"
12+
13+
IFS="." read -ra version_parts <<<"$VERSION"
14+
15+
other/version-sync "$GIT_ROOT" "${version_parts[0]}" "${version_parts[1]}" "${version_parts[2]}"

0 commit comments

Comments
 (0)