@cryptotaxi247 / netdata-1 / commits / 13e3eea4f

Clean up dependency handling for CentOS/RHEL (#11515)

* Remove EPEL and OKay repo dependencies for CentOS 8. We don’t actually need anything from EPEL in a vast majority of cases, and the only stuff we needed from OKay is now provided by PowerTools. This makes us a lot more portable overall. * Bundle LWS in CentOS 8 RPMs. This eliminates a need to use EPEL during the package building process, which in turn removes the strict coupling with CentOS as the build platform (most notably, this lets us use Rocky Linux for the build). * Also try using DNF on CentOS systems.

Austin S. Hemmelgarn committed Sep 16, 2021 at 07:09 UTC 13e3eea4f193bc62fa776aaee82b79a21b972a14
2 files changed +13 -23
netdata.spec.in
+2 -2
@@ -126,7 +126,7 @@ BuildRequires: zlib-devel
126 BuildRequires: libuuid-devel
127 BuildRequires: libuv-devel >= 1
128 BuildRequires: openssl-devel
129 -%if 0%{?centos_ver} >= 8 || 0%{?fedora}
129 +%if 0%{?fedora}
130 BuildRequires: libwebsockets-devel >= 3.2
131 %endif
132 %if 0%{?suse_version}
@@ -215,7 +215,7 @@ happened, on your systems and applications.
215 %prep
216 %setup -q -n %{name}-%{version}
217 export CFLAGS="${CFLAGS} -fPIC" && ${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-mosquitto.sh ${RPM_BUILD_DIR}/%{name}-%{version}
218 -%if 0%{?centos_ver} < 8 || 0%{!?fedora:1}
218 +%if 0%{!?fedora:1}
219 export CFLAGS="${CFLAGS} -fPIC" && ${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-lws.sh ${RPM_BUILD_DIR}/%{name}-%{version}
220 %endif
221 # Only bundle libJudy if this isn't Fedora or SUSE
packaging/installer/install-required-packages.sh
+11 -21
@@ -417,12 +417,12 @@ detect_package_manager_from_distribution() {
417 ;;
418
419 centos* | clearos*)
420 - echo >&2 "You should have EPEL enabled to install all the prerequisites."
421 - echo >&2 "Check: http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/"
422 - package_installer="install_yum"
420 + package_installer=""
421 tree="centos"
422 + [ -n "${dnf}" ] && package_installer="install_dnf"
423 + [ -n "${yum}" ] && package_installer="install_yum"
424 if [ "${IGNORE_INSTALLED}" -eq 0 ] && [ -z "${yum}" ]; then
425 - echo >&2 "command 'yum' is required to install packages on a '${distribution} ${version}' system."
425 + echo >&2 "command 'yum' or 'dnf' is required to install packages on a '${distribution} ${version}' system."
426 exit 1
427 fi
428 ;;
@@ -430,8 +430,8 @@ detect_package_manager_from_distribution() {
430 fedora* | redhat* | red\ hat* | rhel*)
431 package_installer=
432 tree="rhel"
433 - [ -n "${yum}" ] && package_installer="install_yum"
433 [ -n "${dnf}" ] && package_installer="install_dnf"
434 + [ -n "${yum}" ] && package_installer="install_yum"
435 if [ "${IGNORE_INSTALLED}" -eq 0 ] && [ -z "${package_installer}" ]; then
436 echo >&2 "command 'yum' or 'dnf' is required to install packages on a '${distribution} ${version}' system."
437 exit 1
@@ -499,7 +499,11 @@ check_package_manager() {
499 dnf)
500 [ "${IGNORE_INSTALLED}" -eq 0 ] && [ -z "${dnf}" ] && echo >&2 "${1} is not available." && return 1
501 package_installer="install_dnf"
502 - tree="rhel"
502 + if [ "${distribution}" = "centos" ]; then
503 + tree="centos"
504 + else
505 + tree="rhel"
506 + fi
507 detection="user-input"
508 return 0
509 ;;
@@ -1548,13 +1552,6 @@ validate_tree_centos() {
1552
1553 echo >&2 " > CentOS Version: ${version} ..."
1554
1551 - echo >&2 " > Checking for epel ..."
1552 - if ! rpm -qa | grep epel > /dev/null; then
1553 - if prompt "epel not found, shall I install it?"; then
1554 - run ${sudo} yum ${opts} install epel-release
1555 - fi
1556 - fi
1557 -
1555 if [[ "${version}" =~ ^8(\..*)?$ ]]; then
1556 echo >&2 " > Checking for config-manager ..."
1557 if ! run yum ${sudo} config-manager; then
@@ -1570,13 +1567,6 @@ validate_tree_centos() {
1567 fi
1568 fi
1569
1573 - echo >&2 " > Checking for Okay ..."
1574 - if ! rpm -qa | grep okay > /dev/null; then
1575 - if prompt "okay not found, shall I install it?"; then
1576 - run ${sudo} yum ${opts} install http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-5.el8.noarch.rpm
1577 - fi
1578 - fi
1579 -
1570 echo >&2 " > Updating libarchive ..."
1571 run ${sudo} yum ${opts} install libarchive
1572
@@ -1619,7 +1609,7 @@ install_yum() {
1609 read -r -a yum_opts <<< "${opts}"
1610
1611 # install the required packages
1622 - run ${sudo} yum "${yum_opts[@]}" install "${@}" # --enablerepo=epel-testing
1612 + run ${sudo} yum "${yum_opts[@]}" install "${@}"
1613 }
1614
1615 # -----------------------------------------------------------------------------