Skip to content

Commit ee676cc

Browse files
committed
Make b2 version detection more robust
1 parent 4a31b93 commit ee676cc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ci/common_install.sh

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

177177
if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then
178178
trap show_bootstrap_log ERR
179-
if [ ! -f b2 ]; then
179+
# 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.
180+
# The user may clear cache or delete b2 beforehand if they wish to rebuild.
181+
if [ ! -f b2 ] || ! b2_version_output=$(./b2 --version); then
180182
${B2_WRAPPER} ./bootstrap.sh
181183
else
182-
# b2 already exists. This would (only) happen in a caching scenario. The purpose of caching is to save time by not recompiling everything.
183-
# The user may clear cache or delete b2 beforehand if they wish to rebuild.
184-
185184
# b2 expects versions to match
186-
engineversion=$(./b2 --version | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1)
187-
enginemajorversion=$(echo ${engineversion} | cut -d'.' -f1)
188-
engineminorversion=$(echo ${engineversion} | cut -d'.' -f2)
185+
engineversion=$(echo "$b2_version_output" | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1)
186+
enginemajorversion=$(echo "${engineversion}" | cut -d'.' -f1)
187+
engineminorversion=$(echo "${engineversion}" | cut -d'.' -f2)
189188
coremajorversion=$(grep VERSION_MAJOR tools/build/src/engine/patchlevel.h | tr -s ' ' | cut -d' ' -f 3)
190189
coreminorversion=$(grep VERSION_MINOR tools/build/src/engine/patchlevel.h | tr -s ' ' | cut -d' ' -f 3)
191190
if [[ "${enginemajorversion}" == "${coremajorversion}" ]] && [[ "${engineminorversion}" == "${coreminorversion}" ]]; then

0 commit comments

Comments
 (0)