diff --git a/keycloak-httpd-client-install.spec b/keycloak-httpd-client-install.spec index 527f5ab..b1f0b11 100644 --- a/keycloak-httpd-client-install.spec +++ b/keycloak-httpd-client-install.spec @@ -1,13 +1,20 @@ %global srcname keycloak-httpd-client-install %global summary Tools to configure Apache HTTPD as Keycloak client -%if 0%{?fedora} -%global with_python3 1 +%global with_python2 0 +%global with_python3 0 + +%if (0%{?fedora} > 0 && 0%{?fedora} < 32) || (0%{?rhel} > 0 && 0%{?rhel} <= 7) + %global with_python2 1 +%endif + +%if 0%{?fedora} || 0%{?rhel} >= 8 + %global with_python3 1 %endif Name: %{srcname} Version: 0.8 -Release: 4%{?dist} +Release: 5%{?dist} Summary: %{summary} %global git_tag RELEASE_%(r=%{version}; echo $r | tr '.' '_') @@ -18,7 +25,10 @@ Source0: https://github.com/jdennis/keycloak-httpd-client-install/archive BuildArch: noarch +%if %{with_python2} BuildRequires: python2-devel +%endif # with_python2 + %if 0%{?with_python3} BuildRequires: python3-devel %endif @@ -33,6 +43,7 @@ libraries and tools which can automate and simplify configuring an Apache HTTPD authentication module and registering as a client of a Keycloak IdP. +%if %{with_python2} %package -n python2-%{srcname} Summary: %{summary} @@ -48,6 +59,7 @@ Requires: %{_bindir}/keycloak-httpd-client-install Keycloak is an authentication server. This package contains libraries and programs which can invoke the Keycloak REST API and configure clients of a Keycloak server. +%endif # with_python2 %if 0%{?with_python3} %package -n python3-%{srcname} @@ -71,22 +83,30 @@ of a Keycloak server. %autosetup -n %{srcname}-%{version} %build +%if %{with_python2} %py2_build +%endif # with_python2 + %if 0%{?with_python3} %py3_build %endif %install +%if %{with_python2} # Must do the python2 install first because the scripts in /usr/bin are # overwritten with every setup.py install, and in general we want the # python3 version to be the default. %py2_install +%endif # with_python2 + %if 0%{?with_python3} # py3_install won't overwrite files if they have a timestamp greater-than # or equal to the py2 installed files. If both the py2 and py3 builds execute # quickly the files end up with the same timestamps thus leaving the py2 # version in the py3 install. Therefore remove any files susceptible to this. +%if %{with_python2} rm %{buildroot}%{_bindir}/keycloak-httpd-client-install +%endif # with_python2 %py3_install %endif @@ -98,13 +118,16 @@ install -c -m 644 doc/keycloak-httpd-client-install.8 %{buildroot}/%{_mandir}/ma %doc README.md doc/ChangeLog %{_datadir}/%{srcname}/ +%if %{with_python2} # Note that there is no %%files section for the unversioned python module if we are building for several python runtimes %files -n python2-%{srcname} %{python2_sitelib}/* + %if ! 0%{?with_python3} %{_bindir}/keycloak-httpd-client-install %{_mandir}/man8/* %endif +%endif # with_python2 %if 0%{?with_python3} %files -n python3-%{srcname} @@ -114,6 +137,9 @@ install -c -m 644 doc/keycloak-httpd-client-install.8 %{buildroot}/%{_mandir}/ma %endif %changelog +* Mon Jul 9 2018 - 0.8-5 +- Share same spec file with RHEL + * Tue Jun 19 2018 Miro HronĨok - 0.8-4 - Rebuilt for Python 3.7