From 1338e698d1db1b6a9235bfb9df76a5b3af216a62 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 20 Aug 2020 19:00:33 +0200 Subject: [PATCH] scripts/pkgdep: [rhel] Configure EPEL repo prior installing any packages For some RHEL releases, especially 8.x, EPEL repo is crucial in order to install most of the package dependencies, hence we need to make sure it's in use. Change-Id: Iaaa1f901e6fffddb65b98fa98b21b9e77e59760f Signed-off-by: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3872 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- scripts/pkgdep/rhel.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/scripts/pkgdep/rhel.sh b/scripts/pkgdep/rhel.sh index c56c113b5..53eea999d 100755 --- a/scripts/pkgdep/rhel.sh +++ b/scripts/pkgdep/rhel.sh @@ -1,5 +1,24 @@ #!/usr/bin/env bash +# First, add extra EPEL repo to have a chance of covering most of the packages +# on the enterprise systems, like RHEL. +if [[ $ID == centos || $ID == rhel ]]; then + if ! rpm --quiet -q epel-release; then + [[ $VERSION_ID == 7* ]] && epel=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + [[ $VERSION_ID == 8* ]] && epel=https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm + if [[ -n $epel ]]; then + yum install -y "$epel" + fi + fi + # Potential dependencies for EPEL packages can be needed from other repos, enable them + if [[ $ID == rhel ]]; then + [[ $VERSION_ID == 7* ]] && subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" + [[ $VERSION_ID == 8* ]] && subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms + elif [[ $ID == centos ]]; then + yum --enablerepo=extras install -y epel-release + fi +fi + # Minimal install if echo "$ID $VERSION_ID" | grep -E -q 'centos 8'; then # Add PowerTools needed for install CUnit-devel in Centos8 @@ -31,19 +50,6 @@ yum install -y autoconf automake libtool help2man yum install -y numactl-devel nasm if [[ $INSTALL_DEV_TOOLS == "true" ]]; then # Tools for developers - # Includes Fedora, CentOS 7, RHEL 7 - # Add EPEL repository for CUnit-devel - if echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7|centos 8'; then - if ! rpm --quiet -q epel-release; then - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - fi - - if [[ $ID = 'rhel' ]]; then - subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" - elif [[ $ID = 'centos' ]]; then - yum --enablerepo=extras install -y epel-release - fi - fi if echo "$ID $VERSION_ID" | grep -E -q 'centos 8'; then yum install -y python3-pycodestyle echo "Centos 8 does not have lcov and ShellCheck dependencies"