test $1 != $(echo -e "$1\n$2" | sort -rV | head -n 1)
}
+function ensure_decent_gcc_on_rh {
+ local old=$(gcc -dumpversion)
+ local expected=5.1
+ local dts_ver=$1
+ if version_lt $old $expected; then
+ if test -t 1; then
+ # interactive shell
+ cat <<EOF
+Your GCC is too old. Please run following command to add DTS to your environment:
+
+scl enable devtoolset-8 bash
+
+Or add following line to the end of ~/.bashrc to add it permanently:
+
+source scl_source enable devtoolset-8
+
+see https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ for more details.
+EOF
+ else
+ # non-interactive shell
+ source /opt/rh/devtoolset-$dts_ver/enable
+ fi
+ fi
+}
+
for_make_check=false
if tty -s; then
# interactive
if test $ID = centos -a $MAJOR_VERSION = 8 ; then
# Enable 'powertools' or 'PowerTools' repo
$SUDO dnf config-manager --set-enabled $(dnf repolist --all 2>/dev/null|gawk 'tolower($0) ~ /^powertools\s/{print $1}')
+ case "$ARCH" in
+ x86_64)
+ $SUDO dnf -y install centos-release-scl
+ dts_ver=8
+ ;;
+ aarch64)
+ $SUDO dnf -y install centos-release-scl-rh
+ $SUDO dnf config-manager --disable centos-sclo-rh
+ $SUDO dnf config-manager --enable centos-sclo-rh-testing
+ dts_ver=8
+ ;;
+ esac
# before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
$SUDO dnf config-manager --add-repo http://apt-mirror.front.sepia.ceph.com/lab-extras/8/
$SUDO dnf config-manager --setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck=0 --save
$SUDO dnf -y module enable javapackages-tools
elif test $ID = rhel -a $MAJOR_VERSION = 8 ; then
+ $SUDO dnf config-manager \
+ --enable rhel-server-rhscl-8-rpms \
+ --enable rhel-8-server-optional-rpms \
+ --enable rhel-8-server-devtools-rpms
+ dts_ver=8
$SUDO dnf config-manager --set-enabled "codeready-builder-for-rhel-8-${ARCH}-rpms"
$SUDO dnf config-manager --add-repo http://apt-mirror.front.sepia.ceph.com/lab-extras/8/
$SUDO dnf config-manager --setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck=0 --save
$SUDO dnf install -y python3-devel
$SUDO $builddepcmd $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out
[ ${PIPESTATUS[0]} -ne 0 ] && exit 1
+ if [ -n "$dts_ver" ]; then
+ ensure_decent_gcc_on_rh $dts_ver
+ fi
IGNORE_YUM_BUILDEP_ERRORS="ValueError: SELinux policy is not managed or store cannot be accessed."
sed "/$IGNORE_YUM_BUILDEP_ERRORS/d" $DIR/yum-builddep.out | grep -qi "error:" && exit 1
# for rgw motr backend build checks