Skip to content

Commit d7e2ad2

Browse files
PXB-3745: enable AL2023 in pxc-build install-deps
- Add the .amzn2023 branch: RHVER sentinel, base-repo-only package set, word-wise skip list for packages AL2023 does not ship, nmap-ncat for netcat, no scons (modern builds use cmake) - Skip the deprecated tools repo and EPEL on AL2023 and OL10; qpress stays limited to the 8.0 platforms that require it - gcc14 toolchain for AL2023 in build-binary - Fix PGKLIST typo so libsasl2-modules-gssapi-mit and libgnutls28-dev install on deb images (were appended to a dead variable)
1 parent a3195f7 commit d7e2ad2

2 files changed

Lines changed: 114 additions & 100 deletions

File tree

pxb/v2/local/build-binary

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ if [[ "${DOCKER_OS}" = "centos-8" ]] || [[ "${DOCKER_OS}" = "asan" ]]; then
106106
fi
107107
fi
108108

109+
# AL2023 ships gcc14 as the named package, not an SCL. Set CC/CXX directly.
110+
if [[ "${DOCKER_OS}" = "amazonlinux-2023" ]] && [[ ${XB_VERSION_MAJOR} -ge 9 ]]; then
111+
export CC=gcc14-gcc
112+
export CXX=gcc14-g++
113+
fi
114+
109115
XTRABACKUP_VERSION="${XB_VERSION_MAJOR}.${XB_VERSION_MINOR}.${XB_VERSION_PATCH}${XB_VERSION_EXTRA}"
110116
FULL_PRODUCT_NAME="percona-xtrabackup-${XTRABACKUP_VERSION}-$(uname -s)-$(uname -m)-${DOCKER_OS}${TAG}"
111117

pxc/docker/install-deps

Lines changed: 108 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,44 @@
33
set -o xtrace
44
set -o errexit
55
#
6+
7+
# Bounded retry for transient failures (network blips, locked repo metadata).
8+
# Fail-fast after RETRY_MAX attempts so docker build does not hang on
9+
# permanent errors (404, missing package). Backoff is linear: 1s, 2s, ..., Ns.
10+
RETRY_MAX="${RETRY_MAX:-5}"
11+
retry() {
12+
local attempt=0
13+
until "$@"; do
14+
attempt=$((attempt + 1))
15+
if [ "$attempt" -ge "$RETRY_MAX" ]; then
16+
echo "FATAL: retry exhausted after ${RETRY_MAX} attempts: $*" >&2
17+
return 1
18+
fi
19+
sleep "$attempt"
20+
done
21+
}
22+
623
DOWNLOAD_ROOT=/tmp/source_downloads
724
wget_loop() {
825
local FILE="$1"
926
local URL="$2"
1027

1128
mkdir -p "${DOWNLOAD_ROOT}"
12-
until wget --progress=dot:giga -O "${DOWNLOAD_ROOT}/${FILE}" "${URL}"; do
13-
echo "sleep before retry"
14-
sleep 1
15-
done
29+
retry wget --progress=dot:giga -O "${DOWNLOAD_ROOT}/${FILE}" "${URL}"
1630
}
17-
#
31+
32+
# Distro facts. Empty on apt-based systems; computed inside the yum block below.
33+
RHVER=""
34+
DIST=""
35+
1836
if [ -f /usr/bin/yum ]; then
37+
# AL2023 does not define %rhel, so use a sentinel to keep the RHVER
38+
# arithmetic comparisons throughout this block reliable.
1939
RHVER="$(rpm --eval %rhel)"
40+
DIST="$(rpm --eval %dist)"
41+
[[ "${DIST}" == ".amzn2023" ]] && RHVER=2023
42+
43+
mkdir -p /etc/yum/vars
2044
rpm --eval %_arch > /etc/yum/vars/basearch
2145

2246
yum list installed
@@ -26,43 +50,31 @@ if [ -f /usr/bin/yum ]; then
2650
sed -i 's|#\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
2751
fi
2852

53+
# percona-release supplies the (deprecated) tools repo with qpress for the
54+
# OL8/OL9/CentOS7 (8.0) builds below. AL2023 (RHVER sentinel 2023) and OL10
55+
# build 8.4+/9.7+, which do not install qpress, so they skip it.
2956
if [[ ${RHVER} -lt 10 ]]; then
3057
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
3158
percona-release enable-only tools testing
3259
fi
3360

34-
until yum -y update; do
35-
yum clean all
36-
echo "waiting"
37-
sleep 1
38-
done
61+
retry sh -c 'yum clean all && yum -y update'
3962

4063
PKGLIST+=" wget"
4164

65+
# AL2023 has no EPEL and needs none (packages come from the distro base repos),
66+
# so it intentionally matches no branch here.
4267
if [[ ${RHVER} -eq 10 ]]; then
43-
until yum -y install oracle-epel-release-el10; do
44-
echo "waiting"
45-
sleep 1
46-
done
68+
retry yum -y install oracle-epel-release-el10
4769
elif [[ ${RHVER} -eq 8 ]]; then
48-
until yum -y install oracle-epel-release-el8; do
49-
echo "waiting"
50-
sleep 1
51-
done
52-
else
53-
until yum -y install epel-release; do
54-
echo "waiting"
55-
sleep 1
56-
done
70+
retry yum -y install oracle-epel-release-el8
71+
elif [[ ${RHVER} -eq 9 ]] || [[ ${RHVER} -eq 7 ]]; then
72+
retry yum -y install epel-release
5773
fi
5874

5975
if [[ ${RHVER} -eq 8 ]]; then
6076
PKGLIST+=" dnf-utils"
61-
until yum -y install ${PKGLIST} ; do
62-
echo "waiting"
63-
sleep 1
64-
done
65-
77+
retry yum -y install ${PKGLIST}
6678
wget https://downloads.percona.com/downloads/packaging/python2-scons-3.0.1-9.el8.noarch.rpm -O /tmp/python2-scons-3.0.1-9.el8.noarch.rpm
6779
wget https://downloads.percona.com/downloads/packaging/procps-ng-3.3.15-14.0.1.el8.x86_64.rpm -O /tmp/procps-ng-3.3.15-14.0.1.el8.x86_64.rpm
6880
wget https://downloads.percona.com/downloads/packaging/procps-ng-devel-3.3.15-14.0.1.el8.x86_64.rpm -O /tmp/procps-ng-devel-3.3.15-14.0.1.el8.x86_64.rpm
@@ -78,41 +90,31 @@ if [ -f /usr/bin/yum ]; then
7890

7991
if [[ ${RHVER} -eq 9 ]]; then
8092
PKGLIST+=" dnf-utils"
81-
until yum -y install ${PKGLIST} ; do
82-
echo "waiting"
83-
sleep 1
84-
done
85-
93+
retry yum -y install ${PKGLIST}
8694
dnf config-manager --enable ol9_codeready_builder
8795
PKGLIST+=" libedit-devel procps-ng-devel"
8896
fi
8997

9098
if [[ ${RHVER} -eq 10 ]]; then
9199
PKGLIST+=" dnf-utils"
92-
until yum -y install ${PKGLIST} ; do
93-
echo "waiting"
94-
sleep 1
95-
done
96-
100+
retry yum -y install ${PKGLIST}
97101
dnf config-manager --enable ol10_codeready_builder
98102
PKGLIST+=" libedit-devel procps-ng-devel"
99103
fi
100104

105+
if [[ "${DIST}" == ".amzn2023" ]]; then
106+
retry yum -y install ${PKGLIST}
107+
PKGLIST+=" libedit-devel procps-ng-devel"
108+
fi
109+
101110
if [[ ${RHVER} -lt 8 ]]; then
102111
PKGLIST+=" python-docutils procps-ng-devel"
103-
until yum -y install centos-release-scl; do
104-
echo "waiting"
105-
sleep 1
106-
done
112+
retry yum -y install centos-release-scl
107113
# switch to vault scl repos
108114
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
109115
sed -i 's|#\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
110116
fi
111-
until yum -y install ${PKGLIST}; do
112-
echo "waiting"
113-
sleep 1
114-
done
115-
117+
retry yum -y install ${PKGLIST}
116118
if [[ ${RHVER} -eq 8 ]]; then
117119
dnf config-manager --enable ol8_codeready_builder
118120
fi
@@ -128,20 +130,42 @@ if [ -f /usr/bin/yum ]; then
128130
cyrus-sasl-devel cyrus-sasl-scram krb5-devel libudev-devel python3-pip python3-devel libevent-devel \
129131
"
130132

133+
# AL2023 does not ship a few of the above packages. Drop them word-wise so the
134+
# final yum install does not fail (order-independent, unlike a substring strip).
135+
# systemd-devel (added in the PXC-specific block below) substitutes
136+
# libudev-devel. perl-Sys-MemInfo and ccache are not required to build pxb on
137+
# AL2023; skip them.
138+
if [[ "${DIST}" == ".amzn2023" ]]; then
139+
AL2023_SKIP=" perl-Sys-MemInfo ccache libudev-devel "
140+
_filtered=""
141+
for pkg in ${PKGLIST}; do
142+
[[ "${AL2023_SKIP}" == *" ${pkg} "* ]] && continue
143+
_filtered+=" ${pkg}"
144+
done
145+
PKGLIST="${_filtered}"
146+
fi
147+
131148
# mysql-devel / mariadb-connector-c-devel
132-
if [[ ${RHVER} -eq 10 ]]; then
149+
if [[ ${RHVER} -eq 10 ]] || [[ "${DIST}" == ".amzn2023" ]]; then
133150
PKGLIST+=" mariadb-connector-c-devel"
134151
else
135152
PKGLIST+=" mysql-devel"
136153
fi
137154

138-
# PXC specific
139-
PKGLIST+=" libmicrohttpd-devel re2-devel check-devel scons libgcrypt-devel libev-devel vim-common \
140-
perl-CPAN rsync python3 patchelf automake bzip2 gnutls gnutls-devel patch lsof socat stunnel pigz net-tools netcat \
155+
# PXC specific (common list; only scons and the netcat package name differ by distro)
156+
PKGLIST+=" libmicrohttpd-devel re2-devel check-devel libgcrypt-devel libev-devel vim-common \
157+
perl-CPAN rsync python3 patchelf automake bzip2 gnutls gnutls-devel patch lsof socat stunnel pigz net-tools \
141158
"
159+
if [[ "${DIST}" == ".amzn2023" ]]; then
160+
# AL2023: scons is not packaged (modern builds use cmake); netcat is nmap-ncat.
161+
PKGLIST+=" nmap-ncat"
162+
else
163+
PKGLIST+=" scons netcat"
164+
fi
142165

143-
# qpress comes from Percona repo (disabled on OL10)
144-
if [[ ${RHVER} -lt 10 ]]; then
166+
# qpress comes from Percona repo (disabled on OL10 and AL2023; not needed
167+
# for 8.4+/9.7+ which is the only set that targets AL2023).
168+
if [[ ${RHVER} -lt 10 ]] && [[ "${DIST}" != ".amzn2023" ]]; then
145169
PKGLIST+=" qpress"
146170
fi
147171

@@ -187,16 +211,27 @@ if [ -f /usr/bin/yum ]; then
187211
PKGLIST_DEVTOOLSET15+=" gcc-toolset-15-libasan-devel gcc-toolset-15-libubsan-devel"
188212
fi
189213

190-
# KH: why?
191-
if [[ ${RHVER} -ne 8 ]]; then
214+
if [[ "${DIST}" == ".amzn2023" ]]; then
215+
# AL2023 lacks gcc-toolset SCLs; gcc14 + gcc14-c++ provide modern toolchain.
216+
# systemd-devel replaces libudev-devel. asio is bundled (see below).
217+
PKGLIST+=" lz4 perl-Memoize perl-open valgrind-devel libubsan rpcgen libtirpc-devel boost-devel"
218+
PKGLIST+=" gflags-devel util-linux"
219+
PKGLIST+=" libxcrypt-compat ncurses-compat-libs libxcrypt-devel cyrus-sasl-gssapi"
220+
PKGLIST+=" systemd-devel"
221+
PKGLIST+=" gcc14 gcc14-c++ gcc14-plugin-devel"
222+
fi
223+
224+
# asio-devel is not packaged on AL2023; xtrabackup bundles asio internally,
225+
# so the build succeeds without it.
226+
if [[ ${RHVER} -ne 8 ]] && [[ "${DIST}" != ".amzn2023" ]]; then
192227
PKGLIST+=" asio-devel"
193228
fi
194229

195230
if [[ ${RHVER} -eq 9 ]] || [[ ${RHVER} -eq 10 ]]; then
196231
PKGLIST+=" gflags-devel util-linux libtirpc-devel rpcgen boost-devel"
197232
fi
198233

199-
# compat packages available on OL9 but not on OL10
234+
# compat packages available on OL9 / AL2023 but not on OL10
200235
if [[ ${RHVER} -eq 9 ]]; then
201236
PKGLIST+=" libxcrypt-compat ncurses-compat-libs"
202237
fi
@@ -232,39 +267,23 @@ if [ -f /usr/bin/yum ]; then
232267
PKGLIST+=" devtoolset-8-valgrind devtoolset-8-valgrind-devel perl-Digest-Perl-MD5 libedit-devel"
233268
fi
234269

235-
until yum -y install ${PKGLIST} ; do
236-
echo "waiting"
237-
sleep 1
238-
done
239-
270+
retry yum -y install ${PKGLIST}
240271
if [[ ${RHVER} -eq 10 ]]; then
241-
until yum -y install ${PKGLIST_DEVTOOLSET15}; do
242-
echo "waiting"
243-
sleep 1
244-
done
272+
retry yum -y install ${PKGLIST_DEVTOOLSET15}
245273
elif [[ ${RHVER} -eq 9 ]]; then
246-
until yum -y install ${PKGLIST_DEVTOOLSET12} ${PKGLIST_DEVTOOLSET13}; do
247-
echo "waiting"
248-
sleep 1
249-
done
274+
retry yum -y install ${PKGLIST_DEVTOOLSET12} ${PKGLIST_DEVTOOLSET13}
250275
elif [[ ${RHVER} -eq 8 ]]; then
251-
until yum -y install ${PKGLIST_DEVTOOLSET10} ${PKGLIST_DEVTOOLSET11} ${PKGLIST_DEVTOOLSET12} ${PKGLIST_DEVTOOLSET13} ${PKGLIST_DEVTOOLSET14}; do
252-
echo "waiting"
253-
sleep 1
254-
done
276+
retry yum -y install ${PKGLIST_DEVTOOLSET10} ${PKGLIST_DEVTOOLSET11} ${PKGLIST_DEVTOOLSET12} ${PKGLIST_DEVTOOLSET13} ${PKGLIST_DEVTOOLSET14}
255277
elif [[ ${RHVER} -eq 7 ]]; then
256-
until yum -y --enablerepo=centos-sclo-rh-testing install ${PKGLIST_DEVTOOLSET10} ${PKGLIST_DEVTOOLSET11}; do
257-
echo "waiting"
258-
sleep 1
259-
done
278+
retry yum -y --enablerepo=centos-sclo-rh-testing install ${PKGLIST_DEVTOOLSET10} ${PKGLIST_DEVTOOLSET11}
260279
fi
261280

262281
if [[ ${RHVER} -eq 8 ]]; then
263282
yum -y install python2 libtool
264283
update-alternatives --set python /usr/bin/python2
265284
fi
266285

267-
if [[ ${RHVER} -eq 9 ]] || [[ ${RHVER} -eq 10 ]]; then
286+
if [[ ${RHVER} -eq 9 ]] || [[ ${RHVER} -eq 10 ]] || [[ "${DIST}" == ".amzn2023" ]]; then
268287
ln -fs /usr/bin/python3 /usr/bin/python
269288
fi
270289

@@ -273,32 +292,26 @@ if [ -f /usr/bin/yum ]; then
273292
rm /anaconda-post.log
274293
fi
275294
# Install mysql-connector for QA framework run
276-
if [[ ${RHVER} -ge 10 ]]; then
295+
# AL2023 pip3 (21.x) lacks --break-system-packages; PEP 668 is not enforced
296+
# there anyway, so the plain "pip3 install" form is sufficient.
297+
if [[ ${RHVER} -ge 10 ]] && [[ "${DIST}" != ".amzn2023" ]]; then
277298
pip3 install --break-system-packages mysql-connector mysqlclient
278299
else
279300
pip3 install mysql-connector mysqlclient
280301
fi
302+
281303
fi
282304

283305
if [ -f /usr/bin/apt-get ]; then
284306
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
285307

286-
until apt-get update; do
287-
sleep 1
288-
echo "waiting"
289-
done
308+
retry apt-get update
290309

291-
until apt-get -y install lsb-release gnupg wget bc curl; do
292-
sleep 1
293-
echo "waiting"
294-
done
310+
retry apt-get -y install lsb-release gnupg wget bc curl
295311

296312
DIST=$(lsb_release -sc)
297313

298-
until apt-get update; do
299-
sleep 1
300-
echo "waiting"
301-
done
314+
retry apt-get update
302315

303316
# Percona Server (keep this list the same as in PS install-deps)
304317
PKGLIST=" \
@@ -318,7 +331,7 @@ if [ -f /usr/bin/apt-get ]; then
318331
python3-sphinx stunnel pigz net-tools netcat-openbsd \
319332
"
320333
# PXC specific - TODO: these packages are not present in PS, but were specified in common list. Verify if/why they are needed
321-
PGKLIST+=" libsasl2-modules-gssapi-mit libgnutls28-dev"
334+
PKGLIST+=" libsasl2-modules-gssapi-mit libgnutls28-dev"
322335

323336
# liblz4-tool renamed to lz4 in Trixie
324337
if [[ ${DIST} == "trixie" ]]; then
@@ -411,11 +424,7 @@ if [ -f /usr/bin/apt-get ]; then
411424
PKGLIST+=" libre2-dev"
412425
fi
413426

414-
until apt-get -y install ${PKGLIST}; do
415-
echo "waiting"
416-
sleep 1
417-
done
418-
427+
retry apt-get -y install ${PKGLIST}
419428
# Install mysql-connector for QA framework run
420429
if [[ ${DIST} == 'bookworm' ]] || [[ ${DIST} == 'noble' ]] || [[ ${DIST} == 'trixie' ]]; then
421430
pip3 install mysql-connector --break-system-packages
@@ -491,10 +500,9 @@ if [ ! -f /usr/local/lib/libeatmydata.so ]; then
491500
fi
492501

493502
if [ -f /usr/bin/yum ]; then
494-
RHVER="$(rpm --eval %rhel)"
495-
if [[ ${RHVER} -ge 10 ]]; then
503+
if [[ ${RHVER} -ge 10 ]] && [[ "${DIST}" != ".amzn2023" ]]; then
496504
pip3 install --break-system-packages --upgrade sphinx==5.3.0
497-
elif [[ ${RHVER} -eq 9 ]]; then
505+
elif [[ ${RHVER} -eq 9 ]] || [[ "${DIST}" == ".amzn2023" ]]; then
498506
pip3 install --upgrade sphinx==5.3.0
499507
else
500508
pip3 install --upgrade sphinx==1.6.7

0 commit comments

Comments
 (0)