Skip to content

Commit 341eee7

Browse files
committed
Make b2 version detection more robust
1 parent 8729c59 commit 341eee7

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

ci/common_install.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,15 @@ function show_bootstrap_log
174174

175175
if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then
176176
trap show_bootstrap_log ERR
177-
if [ ! -f b2 ]; then
177+
# Check if b2 already exists. This would (only) happen in a caching scenario. The purpose of caching is to save time by not recompiling everything.
178+
# The user may clear cache or delete b2 beforehand if they wish to rebuild.
179+
if [ ! -f b2 ] || ! b2_version_output=$(./b2 --version); then
178180
${B2_WRAPPER} ./bootstrap.sh
179181
else
180-
# b2 already exists. This would (only) happen in a caching scenario. The purpose of caching is to save time by not recompiling everything.
181-
# The user may clear cache or delete b2 beforehand if they wish to rebuild.
182-
183182
# b2 expects versions to match
184-
engineversion=$(./b2 --version | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1)
185-
enginemajorversion=$(echo ${engineversion} | cut -d'.' -f1)
186-
engineminorversion=$(echo ${engineversion} | cut -d'.' -f2)
183+
engineversion=$(echo "$b2_version_output" | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1)
184+
enginemajorversion=$(echo "${engineversion}" | cut -d'.' -f1)
185+
engineminorversion=$(echo "${engineversion}" | cut -d'.' -f2)
187186
coremajorversion=$(grep VERSION_MAJOR tools/build/src/engine/patchlevel.h | tr -s ' ' | cut -d' ' -f 3)
188187
coreminorversion=$(grep VERSION_MINOR tools/build/src/engine/patchlevel.h | tr -s ' ' | cut -d' ' -f 3)
189188
if [[ "${enginemajorversion}" == "${coremajorversion}" ]] && [[ "${engineminorversion}" == "${coreminorversion}" ]]; then

0 commit comments

Comments
 (0)