From 6bfc4b41bfa7291eeb54a94c4eac85c7b9357565 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 15 May 2012 11:38:15 -0400 Subject: [PATCH 09/19] RPM: Allow running 'make rpms' on RHEL 5 machines Our previous detection for this was flawed, because the %{rhel} macro did not exist on the version of RPM shipped with RHEL 5, but it worked when building for RHEL 5 through mock. This new patch relies on grepping /etc/redhat-release for the version information. https://fedorahosted.org/sssd/ticket/1206 --- contrib/sssd.spec.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in index e5a4ed523ef71fe5efbe5e533f0ebb52f0d7f0f9..9972ebbd752d0abbcff35639819f03a97b19327c 100644 --- a/contrib/sssd.spec.in +++ b/contrib/sssd.spec.in @@ -3,8 +3,10 @@ %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif -%if (0%{?rhel} == 5) -%{!?is_rhel57: %global is_rhel57 %(%{__grep} -c "5\.[^0-6]" /etc/redhat-release)} +%global is_rhel5 %(%{__grep} -c "release 5" /etc/redhat-release) +%global rhel5_minor %(%{__grep} -o "5.[0-9]*" /etc/redhat-release |%{__sed} -s 's/5.//') + +%if 0%{?is_rhel5} > 0 %global with_unicode_lib --with-unicode-lib=glib2 # we don't want to provide private python extension libs %{?filter_setup: @@ -65,7 +67,7 @@ BuildRequires: automake BuildRequires: libtool BuildRequires: m4 %{?fedora:BuildRequires: popt-devel} -%if 0%{?rhel} <= 5 +%if 0%{?is_rhel5} > 0 BuildRequires: popt %endif %if 0%{?rhel} >= 6 @@ -80,7 +82,7 @@ BuildRequires: libcollection-devel BuildRequires: libini_config-devel BuildRequires: dbus-devel BuildRequires: dbus-libs -%if 0%{?is_rhel57} > 0 +%if 0%{?rhel5_minor} >= 7 BuildRequires: openldap24-libs-devel %else BuildRequires: openldap-devel @@ -106,7 +108,7 @@ BuildRequires: gettext-devel BuildRequires: pkgconfig BuildRequires: findutils -%if 0%{?rhel} == 5 +%if 0%{?is_rhel5} > 0 BuildRequires: glib2-devel %else BuildRequires: libunistring-devel -- 1.7.10.1