@@ -178,6 +178,7 @@ get_sources(){
178178 sed -i " s:@@XB_VERSION_EXTRA@@:${EXTRAVER} :g" storage/innobase/xtrabackup/utils/percona-xtrabackup.spec
179179 sed -i " s:@@XB_RPM_VERSION_EXTRA@@:${RPM_EXTRAVER} :g" storage/innobase/xtrabackup/utils/percona-xtrabackup.spec
180180 sed -i " s:@@XB_REVISION@@:${REVISION} :g" storage/innobase/xtrabackup/utils/percona-xtrabackup.spec
181+ sed -i " s:@@RPM_RELEASE@@:${RPM_RELEASE} :g" storage/innobase/xtrabackup/utils/percona-xtrabackup.spec
181182 #
182183 # create a PXB tar
183184 cd ${WORKDIR} /percona-xtrabackup
@@ -201,6 +202,12 @@ get_system(){
201202 export ARCH=$( echo $( uname -m) | sed -e ' s:i686:i386:g' )
202203 export OS_NAME=" el$RHEL "
203204 export OS=" rpm"
205+ elif [ -f /etc/amazon-linux-release ]; then
206+ GLIBC_VER_TMP=" $( rpm glibc -qa --qf %{VERSION}) "
207+ export RHEL=$( rpm --eval %amzn)
208+ export ARCH=$( echo $( uname -m) | sed -e ' s:i686:i386:g' )
209+ export OS_NAME=" amzn$RHEL "
210+ export OS=" rpm"
204211 else
205212 GLIBC_VER_TMP=" $( dpkg-query -W -f=' ${Version}' libc6 | awk -F' -' ' {print $1}' ) "
206213 export ARCH=$( uname -m)
@@ -247,25 +254,30 @@ install_deps() {
247254 yum -y install git wget yum-utils curl
248255 yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
249256 if [ x" $ARCH " = " xx86_64" ]; then
250- if [ $RHEL = 9 ]; then
251- yum-config-manager --enable ol9_distro_builder
252- yum-config-manager --enable ol9_codeready_builder
253- yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9 .noarch.rpm
257+ if [ ${ RHEL} = 9 -o ${RHEL} = 10 ]; then
258+ yum-config-manager --enable ol ${RHEL} _distro_builder
259+ yum-config-manager --enable ol ${RHEL} _codeready_builder
260+ yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${RHEL} .noarch.rpm
254261 else
255- add_percona_yum_repo
262+ # add_percona_yum_repo
256263 percona-release enable tools testing
257264 fi
258265 else
259266 yum-config-manager --enable ol" ${RHEL} " _codeready_builder
260- yum -y install epel-release
267+ if [ ${RHEL} = 10 ]; then
268+ yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
269+ yum -y install epel-release
270+ else
271+ yum -y install epel-release
272+ fi
261273 fi
262- if [ ${RHEL} = 8 -o ${RHEL} = 9 ]; then
263- PKGLIST+=" binutils-devel python3-pip python3-setuptools libtirpc-devel "
274+ if [[ " ${RHEL} " = " 8 " || " ${RHEL} " = " 9 " || " ${RHEL} " = " 2023 " || " ${RHEL} " = " 10 " ] ]; then
275+ PKGLIST+=" binutils-devel python3-pip python3-setuptools"
264276 PKGLIST+=" libcurl-devel cmake libaio-devel zlib-devel libev-devel bison make"
265277 PKGLIST+=" rpm-build libgcrypt-devel ncurses-devel readline-devel openssl-devel"
266- PKGLIST+=" vim-common rpmlint patchelf python3-wheel libudev-devel"
267- if [ $ RHEL = 9 ]; then
268- PKGLIST+=" rsync procps-ng-devel python3-sphinx gcc gcc-c++"
278+ PKGLIST+=" vim-common rpmlint patchelf python3-wheel libudev-devel libtirpc-devel "
279+ if [[ " ${ RHEL} " = " 9 " || " ${RHEL} " = " 2023 " || " ${RHEL} " = " 10 " ] ]; then
280+ PKGLIST+=" rsync procps-ng-devel python3-sphinx gcc gcc-c++ gcc-gfortran "
269281 else
270282 if [ x" $ARCH " = " xx86_64" ]; then
271283 yum-config-manager --enable powertools
@@ -282,19 +294,20 @@ install_deps() {
282294 sleep 1
283295 done
284296 if [ $RHEL = 8 ]; then
285- DEVTOOLSET10_PKGLIST +=" gcc-toolset-10 -gcc-c++ gcc-toolset-10 -binutils"
286- DEVTOOLSET10_PKGLIST +=" gcc-toolset-10 -valgrind gcc-toolset-10 -valgrind-devel gcc-toolset-10 -libatomic-devel"
287- DEVTOOLSET10_PKGLIST +=" gcc-toolset-10 -libasan-devel gcc-toolset-10 -libubsan-devel gcc-toolset-10 -annobin"
297+ # DEVTOOLSET11_PKGLIST +=" gcc-toolset-11 -gcc-c++ gcc-toolset-11 -binutils"
298+ # DEVTOOLSET11_PKGLIST +=" gcc-toolset-11 -valgrind gcc-toolset-11 -valgrind-devel gcc-toolset-11 -libatomic-devel"
299+ # DEVTOOLSET11_PKGLIST +=" gcc-toolset-11 -libasan-devel gcc-toolset-11 -libubsan-devel gcc-toolset-11 -annobin"
288300 DEVTOOLSET12_PKGLIST+=" gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils"
289301 DEVTOOLSET12_PKGLIST+=" gcc-toolset-12-libasan-devel gcc-toolset-12-libubsan-devel gcc-toolset-12-annobin-annocheck gcc-toolset-12-annobin-plugin-gcc"
302+ /*
290303 if [ x" $ARCH " = " xx86_64" ]; then
291304 yum -y install centos-release-stream
292- until yum -y install ${DEVTOOLSET10_PKGLIST } ; do
305+ until yum -y install ${DEVTOOLSET12_PKGLIST } ; do
293306 echo " waiting"
294307 sleep 1
295308 done
296- update-alternatives --install /usr/bin/gcc gcc /opt/rh/gcc-toolset-10 /root/usr/bin/gcc 10
297- update-alternatives --install /usr/bin/g++ g++ /opt/rh/gcc-toolset-10 /root/usr/bin/g++ 10
309+ update-alternatives --install /usr/bin/gcc gcc /opt/rh/gcc-toolset-11 /root/usr/bin/gcc 11
310+ update-alternatives --install /usr/bin/g++ g++ /opt/rh/gcc-toolset-11 /root/usr/bin/g++ 11
298311 gcc --version
299312 yum -y remove centos-release-stream
300313 else
@@ -304,8 +317,18 @@ install_deps() {
304317 done
305318 update-alternatives --install /usr/bin/gcc gcc /opt/rh/gcc-toolset-12/root/usr/bin/gcc 12
306319 update-alternatives --install /usr/bin/g++ g++ /opt/rh/gcc-toolset-12/root/usr/bin/g++ 12
320+ scl enable gcc-toolset-12 bash
307321 gcc --version
308322 fi
323+ * /
324+ until yum -y install ${DEVTOOLSET12_PKGLIST} ; do
325+ echo " waiting"
326+ sleep 1
327+ done
328+ update-alternatives --install /usr/bin/gcc gcc /opt/rh/gcc-toolset-12/root/usr/bin/gcc 12
329+ update-alternatives --install /usr/bin/g++ g++ /opt/rh/gcc-toolset-12/root/usr/bin/g++ 12
330+ scl enable gcc-toolset-12 bash
331+ gcc --version
309332 fi
310333 else
311334 until yum -y install epel-release centos-release-scl; do
@@ -322,28 +345,14 @@ install_deps() {
322345 echo " waiting"
323346 done
324347 PKGLIST+=" wget libcurl-devel cmake cmake3 make gcc gcc-c++ libev-devel openssl-devel rpm-build"
325- PKGLIST+=" libaio-devel perl-DBD-MySQL vim-common ncurses-devel readline-devel readline"
348+ PKGLIST+=" libaio-devel vim-common ncurses-devel readline-devel readline"
326349 PKGLIST+=" zlib-devel libgcrypt-devel bison patchelf"
327350 PKGLIST+=" socat numactli libudev-devel libicu-devel"
328351 PKGLIST+=" procps-ng-devel"
329- if [[ " ${RHEL} " -eq 7 ]]; then
330- PKGLIST+=" numactl-libs perl-Digest-MD5 python3-pip python3-setuptools python3-wheel rh-python36-python-sphinx"
331- elif [[ " ${RHEL} " -eq 6 ]]; then
332- PKGLIST+=" rh-python36-python-pip rh-python36-docutils rh-python36-python-setuptools"
333- fi
334352 until yum -y install ${PKGLIST} ; do
335353 echo " waiting"
336354 sleep 1
337355 done
338- if [[ " ${RHEL} " -eq 7 ]]; then
339- yum -y --enablerepo=centos-sclo-rh-testing install devtoolset-11-gcc-c++ devtoolset-11-binutils devtoolset-11-valgrind devtoolset-11-valgrind-devel devtoolset-11-libatomic-devel
340- yum -y --enablerepo=centos-sclo-rh-testing install devtoolset-11-libasan-devel devtoolset-11-libubsan-devel
341- yum -y update nss
342- scl enable devtoolset-11 bash
343- elif [[ " ${RHEL} " -eq 6 ]]; then
344- source /opt/rh/rh-python36/enable
345- pip install sphinx
346- fi
347356 fi
348357 else
349358 apt-get update
@@ -356,26 +365,23 @@ install_deps() {
356365 PKGLIST+=" bison cmake devscripts debconf debhelper automake bison ca-certificates libcurl4-openssl-dev"
357366 PKGLIST+=" cmake debhelper libaio-dev libncurses-dev libtool libz-dev libsasl2-dev vim-common"
358367 PKGLIST+=" libgcrypt-dev libev-dev lsb-release libudev-dev pkg-config"
359- PKGLIST+=" build-essential rsync libdbd-mysql-perl libnuma1 socat libssl-dev patchelf libicu-dev"
360- if [ " ${OS_NAME} " == " bookworm" -o " ${OS_NAME} " == " noble" ]; then
368+ PKGLIST+=" build-essential rsync libnuma1 socat libssl-dev patchelf libicu-dev"
369+ if [ " ${OS_NAME} " == " bookworm" -o " ${OS_NAME} " == " noble" -o " ${OS_NAME} " == " trixie " ]; then
361370 PKGLIST+=" libproc2-dev"
362371 else
363372 PKGLIST+=" libprocps-dev"
364373 fi
365- if [ " ${OS_NAME} " == " noble" ]; then
374+ if [ " ${OS_NAME} " == " noble" -o " ${OS_NAME} " == " trixie " ]; then
366375 wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
367376 dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
368377 fi
369- if [ " ${OS_NAME} " == " bionic" ]; then
370- PKGLIST+=" gcc-8 g++-8"
371- fi
372378 if [ " ${OS_NAME} " == " focal" ]; then
373379 PKGLIST+=" gcc-10 g++-10"
374380 fi
375- if [ " ${OS_NAME} " == " noble" ]; then
381+ if [ " ${OS_NAME} " == " noble" -o " ${OS_NAME} " == " trixie " ]; then
376382 PKGLIST+=" libtirpc-dev"
377383 fi
378- if [ " ${OS_NAME} " == " focal" -o " ${OS_NAME} " == " bullseye" -o " ${OS_NAME} " == " bookworm" -o " ${OS_NAME} " == " jammy" -o " ${OS_NAME} " == " noble" ]; then
384+ if [ " ${OS_NAME} " == " focal" -o " ${OS_NAME} " == " bullseye" -o " ${OS_NAME} " == " bookworm" -o " ${OS_NAME} " == " jammy" -o " ${OS_NAME} " == " noble" -o " ${OS_NAME} " == " trixie " ]; then
379385 PKGLIST+=" python3-sphinx python3-docutils"
380386 else
381387 PKGLIST+=" python-sphinx python-docutils"
@@ -467,6 +473,19 @@ build_srpm(){
467473 sed -i " /^%changelog/a - Release ${VERSION} -${RELEASE} " percona-xtrabackup.spec
468474 sed -i " /^%changelog/a * $( date " +%a" ) $( date " +%b" ) $( date " +%d" ) $( date " +%Y" ) Percona Development Team <info@percona.com> - ${VERSION} -${RELEASE} " percona-xtrabackup.spec
469475 #
476+ cd ${WORKDIR} /rpmbuild/SOURCES
477+ wget https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh
478+ cd ${WORKDIR} /rpmbuild/SPECS
479+ line_number=$( grep -n SOURCE999 percona-xtrabackup.spec | awk -F ' :' ' {print $1}' )
480+ cp ../SOURCES/call-home.sh ./
481+ awk -v n=$line_number ' NR <= n {print > "part1.txt"} NR > n {print > "part2.txt"}' percona-xtrabackup.spec
482+ head -n -1 part1.txt > temp && mv temp part1.txt
483+ echo " cat <<'CALLHOME' > /tmp/call-home.sh" >> part1.txt
484+ cat call-home.sh >> part1.txt
485+ echo " CALLHOME" >> part1.txt
486+ cat part2.txt >> part1.txt
487+ rm -f call-home.sh part2.txt
488+ mv part1.txt percona-xtrabackup.spec
470489 cd $WORKDIR
471490 #
472491 mv -fv $TARFILE $WORKDIR /rpmbuild/SOURCES
@@ -524,11 +543,17 @@ build_rpm(){
524543
525544 enable_venv
526545
527- rpmbuild --define " _topdir ${WORKDIR} /rpmbuild" --define " dist .el ${RHEL }" --rebuild rpmbuild/SRPMS/${SRCRPM}
546+ rpmbuild --define " _topdir ${WORKDIR} /rpmbuild" --define " dist .${OS_NAME }" --rebuild rpmbuild/SRPMS/${SRCRPM}
528547 return_code=$?
529548 if [ $return_code != 0 ]; then
530549 exit $return_code
531550 fi
551+
552+ # Verify RPMs were actually produced
553+ if [ -z " $( find ${WORKDIR} /rpmbuild/RPMS -name ' *.rpm' 2> /dev/null) " ]; then
554+ echo " ERROR: rpmbuild succeeded but no RPM files were generated!"
555+ exit 1
556+ fi
532557 mkdir -p ${WORKDIR} /rpm
533558 mkdir -p ${CURDIR} /rpm
534559 cp rpmbuild/RPMS/* /* .rpm ${WORKDIR} /rpm
@@ -557,7 +582,7 @@ build_source_deb(){
557582
558583 echo " DEB_RELEASE=${DEB_RELEASE} " >> ${CURDIR} /percona-xtrabackup-8.0.properties
559584
560- NEWTAR=${NAME} -91_ ${VERSION} .orig.tar.gz
585+ NEWTAR=${NAME} -96_ ${VERSION} .orig.tar.gz
561586 mv ${TARFILE} ${NEWTAR}
562587
563588 tar xzf ${NEWTAR}
@@ -611,6 +636,18 @@ build_deb(){
611636 dpkg-source -x $DSC
612637 cd $DIRNAME
613638 dch -m -D " $OS_NAME " --force-distribution -v " $VERSION -$DEB_RELEASE .$OS_NAME " ' Update distribution'
639+ cd debian/
640+ wget https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh
641+ sed -i ' s:exit 0::' percona-xtrabackup-96.postinst
642+ echo " cat <<'CALLHOME' > /tmp/call-home.sh" >> percona-xtrabackup-96.postinst
643+ cat call-home.sh >> percona-xtrabackup-96.postinst
644+ echo " CALLHOME" >> percona-xtrabackup-96.postinst
645+ echo " bash +x /tmp/call-home.sh -f \" PRODUCT_FAMILY_PXB\" -v \" ${VERSION} -${DEB_RELEASE} \" -d \" PACKAGE\" &>/dev/null || :" >> percona-xtrabackup-96.postinst
646+ echo " rm -rf /tmp/call-home.sh" >> percona-xtrabackup-96.postinst
647+ echo " exit 0" >> percona-xtrabackup-96.postinst
648+ rm -f call-home.sh
649+ cd ../
650+
614651 dpkg-buildpackage -rfakeroot -uc -us -b
615652
616653 cd ${WORKDIR}
0 commit comments