diff --git a/install-deps.sh b/install-deps.sh index c6a935a3df2..873323808e7 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -26,11 +26,11 @@ function munge_ceph_spec_in { sed -e 's/@//g' -e 's/%bcond_with make_check/%bcond_without make_check/g' < ceph.spec.in > $OUTFILE } -function ensure_decent_gcc { +function ensure_decent_gcc_on_deb { # point gcc to the one offered by g++-7 if the used one is not # new enough - old=$(gcc -dumpversion) - new=$1 + local old=$(gcc -dumpversion) + local new=$1 if dpkg --compare-versions $old ge 5.1; then return fi @@ -50,6 +50,38 @@ function ensure_decent_gcc { $SUDO ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++ } +function version_lt { + 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 + case $- in + *i*) + # interactive shell + cat <&1 | tee $DIR/yum-builddep.out + if [ -n dts_ver ]; then + ensure_decent_gcc_on_rh $dts_ver + fi ! grep -q -i error: $DIR/yum-builddep.out || exit 1 ;; opensuse|suse|sles) diff --git a/run-make-check.sh b/run-make-check.sh index 75e7d92b683..72583a1e841 100755 --- a/run-make-check.sh +++ b/run-make-check.sh @@ -60,7 +60,7 @@ function run() { fi if test -f ./install-deps.sh ; then - $DRY_RUN ./install-deps.sh || return 1 + $DRY_RUN source ./install-deps.sh || return 1 fi # Init defaults after deps are installed. get_processors() depends on coreutils nproc.