Skip to content

Commit 1a327ae

Browse files
committed
builder: fix get_sources — quote PERCONAFT/TOKUBACKUP tests, pick cmake3 fallback
Two bugs in get_sources() on the release-9.7.0-1-1 Jenkins build: 1. Lines 223 / 226: `[ ${PERCONAFT_REPO} = 0 ]` / `[ ${TOKUBACKUP_REPO} = 0 ]` When PERCONAFT_REPO / TOKUBACKUP_REPO are empty or unset (the normal case for non-TokuDB builds) the unquoted substitution collapses the test to literal `[ = 0 ]` and bash reports: ./ps_builder.sh: line 223: [: =: unary operator expected ./ps_builder.sh: line 226: [: =: unary operator expected Quote both sides + add `:-` default so the test evaluates as `[ "" = "0" ]` (false) rather than producing a syntax error. 2. Line 269: `cmake . -DWITH_SSL=system ...` PS 9.x requires CMake >= 3.17.5 (top-level CMakeLists.txt:112). Some release build agents still ship CMake 3.16.3 as the default `cmake`, so the configure step aborts: CMake Error at CMakeLists.txt:112 (CMAKE_MINIMUM_REQUIRED): CMake 3.17.5 or higher is required. You are running version 3.16.3 With cmake failing, no Makefile is generated, `make dist` then reports `No rule to make target 'dist'`, and EXPORTED_TAR / PSDIR end up empty. Every later step cascades into corruption: `tar xzf` with no arg, rsync targets resolve to absolute `/storage/...` paths, `cd ${PSDIR}` becomes `cd` (home dir), and the subsequent sed of `build-ps/debian/rules` fails with "No such file". On hosts that have both `cmake` (old) and `cmake3` (EPEL / backports alternative), prefer `cmake3` when the default `cmake` is older than 3.17.5. Same pattern build-ps/pxc_builder.sh already uses for PXC on EL7. This does NOT help hosts where neither `cmake` nor `cmake3` is >= 3.17.5 — those need either a base-image cmake bump or a cmake install in install_deps. Note: the make dist step legitimately needs cmake to copy bison-generated sql_yacc.{h,cc} / sql_hints.yy.{h,cc} into the tarball and to autoreconf UDF/, so replacing it with plain `git archive` would silently drop those pre-generated files. Keeping the cmake+make-dist path and just choosing a sufficient cmake binary is the right answer.
1 parent 0a3a307 commit 1a327ae

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

build-ps/percona-server-9.0_builder.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,12 @@ get_sources(){
220220
git submodule update
221221
rm -rf storage/tokudb/PerconaFT
222222
rm -rf plugin/tokudb-backup-plugin/Percona-TokuBackup
223-
if [ ${PERCONAFT_REPO} = 0 ]; then
223+
# Quote both sides + provide :- default so an empty / unset variable
224+
# does not collapse to literal `[ = 0 ]` and trip "unary operator expected".
225+
if [ "${PERCONAFT_REPO:-}" = "0" ]; then
224226
PERCONAFT_REPO=''
225227
fi
226-
if [ ${TOKUBACKUP_REPO} = 0 ]; then
228+
if [ "${TOKUBACKUP_REPO:-}" = "0" ]; then
227229
TOKUBACKUP_REPO=''
228230
fi
229231

@@ -266,7 +268,24 @@ get_sources(){
266268
#
267269
git submodule update
268270
#
269-
cmake . -DWITH_SSL=system -DFORCE_INSOURCE_BUILD=1 -DWITH_ZLIB=bundled -DWITH_CURL=bundled
271+
# `make dist` is implemented as a cmake-driven custom target in
272+
# sql/CMakeLists.txt → cmake/make_dist.cmake.in, which not only
273+
# git-archives HEAD but also copies bison-generated parser files
274+
# (sql_yacc.{h,cc}, sql_hints.yy.{h,cc}) into the tarball and
275+
# autoreconfs the UDF subtree. cmake configure must succeed first
276+
# for this target to exist, and PS 9.x requires cmake >= 3.17.5.
277+
#
278+
# On hosts where the default `cmake` is older than 3.17.5 (some
279+
# build agents still ship cmake 3.16.3), fall back to `cmake3`
280+
# which is the EPEL/backports alternative providing a newer
281+
# version. Same pattern PXC uses in build-ps/pxc_builder.sh.
282+
CMAKE_BIN="cmake"
283+
if ! cmake --version 2>/dev/null | head -1 | awk '{print $3}' | grep -qE "^([4-9]|3\.(1[7-9]|[2-9][0-9]))"; then
284+
if command -v cmake3 >/dev/null 2>&1; then
285+
CMAKE_BIN="cmake3"
286+
fi
287+
fi
288+
"${CMAKE_BIN}" . -DWITH_SSL=system -DFORCE_INSOURCE_BUILD=1 -DWITH_ZLIB=bundled -DWITH_CURL=bundled
270289
make dist
271290
#
272291
EXPORTED_TAR=$(basename $(find . -type f -name percona-server*.tar.gz | sort | tail -n 1))

0 commit comments

Comments
 (0)