@@ -6,17 +6,32 @@ source "${SCRIPT_DIR}/common_tools.sh"
6
6
# Update Zserio version in a single file.
7
7
update_version_in_file ()
8
8
{
9
- exit_if_argc_ne $# 2
9
+ exit_if_argc_ne $# 3
10
10
local VERSION_FILE=" ${1} " ; shift
11
11
local NEW_VERSION_STRING=" ${1} " ; shift
12
+ local NEW_VERSION_NUMBER=" ${1} " ; shift
12
13
13
- echo -ne " Updating version to ${NEW_VERSION_STRING} in '${VERSION_FILE} '..."
14
+ echo -ne " Updating version string to ${NEW_VERSION_STRING} in '${VERSION_FILE} '..."
14
15
sed -i -e ' s/[0-9]\+\.[0-9]\+\.[0-9]\+\(\-[A-Za-z0-9]\+\)\?/' " ${NEW_VERSION_STRING} " ' /' " ${VERSION_FILE} "
15
16
local SED_RESULT=$?
16
17
if [ ${SED_RESULT} -ne 0 ] ; then
17
18
stderr_echo " Failed with return code ${SED_RESULT} !"
18
19
return 1
19
20
fi
21
+
22
+ sed -i -e ' s/NUMBER\ =\ [0-9]\+/' NUMBER\ =\ ${NEW_VERSION_NUMBER} ' /' " ${VERSION_FILE} "
23
+ local SED_RESULT=$?
24
+ if [ ${SED_RESULT} -ne 0 ] ; then
25
+ stderr_echo " Failed with return code ${SED_RESULT} !"
26
+ return 1
27
+ fi
28
+
29
+ sed -i -e ' s/NUMBER\ [0-9]\+/' NUMBER\ ${NEW_VERSION_NUMBER} ' /' " ${VERSION_FILE} "
30
+ local SED_RESULT=$?
31
+ if [ ${SED_RESULT} -ne 0 ] ; then
32
+ stderr_echo " Failed with return code ${SED_RESULT} !"
33
+ return 1
34
+ fi
20
35
echo " Done"
21
36
22
37
return 0
@@ -25,9 +40,10 @@ update_version_in_file()
25
40
# Update Zserio version in local copy of Git repository.
26
41
update_version ()
27
42
{
28
- exit_if_argc_ne $# 2
43
+ exit_if_argc_ne $# 3
29
44
local ZSERIO_SOURCE_DIR=" ${1} " ; shift
30
45
local NEW_VERSION_STRING=" ${1} " ; shift
46
+ local NEW_VERSION_NUMBER=" ${1} " ; shift
31
47
32
48
# find all files with version
33
49
local PYTHON_RUNTIME_VERSION_FILE=" ${ZSERIO_SOURCE_DIR} /extensions/python/runtime/src/zserio/__init__.py"
@@ -41,7 +57,7 @@ update_version()
41
57
for VERSION_FILE in ${VERSION_FILES}
42
58
do
43
59
if [[ " ${VERSION_FILE} " != " ${COMPATIBILITY_VERSION_FILE} " ]] ; then
44
- update_version_in_file " ${VERSION_FILE} " " ${NEW_VERSION_STRING} "
60
+ update_version_in_file " ${VERSION_FILE} " " ${NEW_VERSION_STRING} " ${NEW_VERSION_NUMBER}
45
61
if [ $? -ne 0 ] ; then
46
62
return 1
47
63
fi
@@ -141,8 +157,13 @@ main()
141
157
return 1
142
158
fi
143
159
160
+ # calculate new version number from string
161
+ local NEW_VERSION_ARRAY=(${NEW_VERSION_STRING// ./ } )
162
+ local NEW_VERSION_NUMBER=$( printf " %d%03d%03d" ${NEW_VERSION_ARRAY[0]} ${NEW_VERSION_ARRAY[1]} \
163
+ ${NEW_VERSION_ARRAY[2]} )
164
+
144
165
# update version
145
- update_version " ${SCRIPT_DIR} /../compiler" " ${NEW_VERSION_STRING} "
166
+ update_version " ${SCRIPT_DIR} /../compiler" " ${NEW_VERSION_STRING} " ${NEW_VERSION_NUMBER}
146
167
if [ $? -ne 0 ] ; then
147
168
return 1
148
169
fi
0 commit comments