From 07a5a989821f384299ebb276c50cc758f4a83b47 Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Fri, 16 Sep 2016 14:29:15 +1000 Subject: [PATCH] build scripts: Enable dnf for Fedora >= 22 The use of yum triggers a warning and reference to yum2dnf on Fedora >= 22. Use either yum or dnf based on the Fedora version. Signed-off-by: Brad Hubbard --- install-deps.sh | 16 ++++++++++++---- run-cmake-check.sh | 11 +++++++++-- run-make-check.sh | 11 +++++++++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index b1e1636c0485..96d66219e065 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -85,11 +85,19 @@ else if [ -n "$backports" ] ; then rm $control; fi ;; centos|fedora|rhel) - echo "Using yum to install dependencies" - $SUDO yum install -y redhat-lsb-core + yumdnf="yum" + builddepcmd="yum-builddep -y" + if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then + yumdnf="dnf" + builddepcmd="dnf -y builddep --allowerasing" + fi + echo "Using $yumdnf to install dependencies" + $SUDO $yumdnf install -y redhat-lsb-core case $(lsb_release -si) in Fedora) - $SUDO yum install -y yum-utils + if test $yumdnf = yum; then + $SUDO $yumdnf install -y yum-utils + fi ;; CentOS|RedHatEnterpriseServer) $SUDO yum install -y yum-utils @@ -108,7 +116,7 @@ else ;; esac sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec - $SUDO yum-builddep -y $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out + $SUDO $builddepcmd $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out ! grep -q -i error: $DIR/yum-builddep.out || exit 1 ;; opensuse|suse) diff --git a/run-cmake-check.sh b/run-cmake-check.sh index 8f95eacd68cf..52b83ab7e191 100755 --- a/run-cmake-check.sh +++ b/run-cmake-check.sh @@ -32,9 +32,16 @@ BUILD_MAKEOPTS=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS} CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS} function run() { - # Same logic as install-deps.sh for finding package installer local install_cmd - test -f /etc/redhat-release && install_cmd="yum install -y" + if test -f /etc/redhat-release ; then + source /etc/os-release + if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then + install_cmd="dnf -y install" + else + install_cmd="yum install -y" + fi + fi + type apt-get > /dev/null 2>&1 && install_cmd="apt-get install -y" type zypper > /dev/null 2>&1 && install_cmd="zypper --gpg-auto-import-keys --non-interactive install" if [ -n "$install_cmd" ]; then diff --git a/run-make-check.sh b/run-make-check.sh index 05230adfd5e3..c6c49cff4107 100755 --- a/run-make-check.sh +++ b/run-make-check.sh @@ -50,9 +50,16 @@ else fi function run() { - # Same logic as install-deps.sh for finding package installer local install_cmd - test -f /etc/redhat-release && install_cmd="yum install -y" + if test -f /etc/redhat-release ; then + source /etc/os-release + if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then + install_cmd="dnf -y install" + else + install_cmd="yum install -y" + fi + fi + type apt-get > /dev/null 2>&1 && install_cmd="apt-get install -y" type zypper > /dev/null 2>&1 && install_cmd="zypper --gpg-auto-import-keys --non-interactive install" if [ -n "$install_cmd" ]; then -- 2.47.3