a21eccd
%global srcname keycloak-httpd-client-install
a21eccd
%global summary Tools to configure Apache HTTPD as Keycloak client
a21eccd
a21eccd
%if 0%{?fedora}
a21eccd
%global with_python3 1
a21eccd
%endif
a21eccd
a21eccd
Name:           %{srcname}
87fc818
Version:        0.4
a21eccd
Release:        1%{?dist}
a21eccd
Summary:        %{summary}
a21eccd
a21eccd
%global git_tag RELEASE_%(r=%{version}; echo $r | tr '.' '_')
a21eccd
a21eccd
License:        GPLv3
a21eccd
URL:            https://github.com/jdennis/keycloak-httpd-client-install
a21eccd
Source0:        https://github.com/jdennis/keycloak-httpd-client-install/archive/%{git_tag}.tar.gz#/%{srcname}-%{version}.tar.gz
a21eccd
a21eccd
BuildArch:      noarch
a21eccd
a21eccd
BuildRequires:  python2-devel
a21eccd
%if 0%{?with_python3}
a21eccd
BuildRequires:  python3-devel
a21eccd
%endif
a21eccd
a21eccd
Requires:       %{_bindir}/keycloak-httpd-client-install
a21eccd
a21eccd
%description
a21eccd
Keycloak is a federated Identity Provider (IdP). Apache HTTPD supports
a21eccd
a variety of authentication modules which can be configured to utilize
a21eccd
a Keycloak IdP to perform authentication. This package contains
a21eccd
libraries and tools which can automate and simplify configuring an
a21eccd
Apache HTTPD authentication module and registering as a client of a
a21eccd
Keycloak IdP.
a21eccd
a21eccd
%package -n python2-%{srcname}
a21eccd
Summary:        %{summary}
a21eccd
a21eccd
%{?python_provide:%python_provide python2-%{srcname}}
a21eccd
a21eccd
Requires:       %{name} = %{version}-%{release}
a21eccd
Requires:       python-requests
a21eccd
Requires:       python-requests-oauthlib
a21eccd
Requires:       python-jinja2
a21eccd
Requires:       %{_bindir}/keycloak-httpd-client-install
a21eccd
a21eccd
%description -n python2-%{srcname}
a21eccd
Keycloak is an authentication server. This package contains libraries and
a21eccd
programs which can invoke the Keycloak REST API and configure clients
a21eccd
of a Keycloak server.
a21eccd
a21eccd
%if 0%{?with_python3}
a21eccd
%package -n python3-%{srcname}
a21eccd
Summary:        %{summary}
a21eccd
a21eccd
%{?python_provide:%python_provide python3-%{srcname}}
a21eccd
a21eccd
Requires:       %{name} = %{version}-%{release}
a21eccd
Requires:       python3-requests
a21eccd
Requires:       python3-requests-oauthlib
a21eccd
Requires:       python3-jinja2
a21eccd
a21eccd
%description -n python3-%{srcname}
a21eccd
Keycloak is an authentication server. This package contains libraries and
a21eccd
programs which can invoke the Keycloak REST API and configure clients
a21eccd
of a Keycloak server.
a21eccd
a21eccd
%endif
a21eccd
a21eccd
%prep
a21eccd
%autosetup -n %{srcname}-%{version}
a21eccd
a21eccd
%build
a21eccd
%py2_build
a21eccd
%if 0%{?with_python3}
a21eccd
%py3_build
a21eccd
%endif
a21eccd
a21eccd
%install
a21eccd
# Must do the python2 install first because the scripts in /usr/bin are
a21eccd
# overwritten with every setup.py install, and in general we want the
a21eccd
# python3 version to be the default.
a21eccd
%py2_install
a21eccd
%if 0%{?with_python3}
a21eccd
# py3_install won't overwrite files if they have a timestamp greater-than
a21eccd
# or equal to the py2 installed files. If both the py2 and py3 builds execute
a21eccd
# quickly the files end up with the same timestamps thus leaving the py2
a21eccd
# version in the py3 install. Therefore remove any files susceptible to this.
a21eccd
rm %{buildroot}%{_bindir}/keycloak-httpd-client-install
a21eccd
%py3_install
a21eccd
%endif
a21eccd
a21eccd
install -d -m 755 %{buildroot}/%{_mandir}/man8
a21eccd
install -c -m 644 doc/keycloak-httpd-client-install.8 %{buildroot}/%{_mandir}/man8
a21eccd
a21eccd
%files
a21eccd
%license LICENSE.txt
a21eccd
%doc README.md doc/ChangeLog
a21eccd
%{_datadir}/%{srcname}/
a21eccd
a21eccd
# Note that there is no %%files section for the unversioned python module if we are building for several python runtimes
a21eccd
%files -n python2-%{srcname}
a21eccd
%{python2_sitelib}/*
a21eccd
%if ! 0%{?with_python3}
a21eccd
%{_bindir}/keycloak-httpd-client-install
a21eccd
%{_mandir}/man8/*
a21eccd
%endif
a21eccd
a21eccd
%if 0%{?with_python3}
a21eccd
%files -n python3-%{srcname}
a21eccd
%{python3_sitelib}/*
a21eccd
%{_bindir}/keycloak-httpd-client-install
a21eccd
%{_mandir}/man8/*
a21eccd
%endif
a21eccd
a21eccd
%changelog
87fc818
* Mon Jun 27 2016 John Dennis <jdennis@redhat.com> - 0.4-1
87fc818
- new upstream
87fc818
  See ChangeLog for details
87fc818
a21eccd
* Fri May 20 2016 John Dennis <jdennis@redhat.com> - 0.3-1
a21eccd
- new upstream
a21eccd
  See ChangeLog for details
a21eccd
a21eccd
* Tue May 17 2016 John Dennis <jdennis@redhat.com> - 0.2-1
a21eccd
- new upstream
a21eccd
- Add keycloak-httpd-client-install.8 man page
a21eccd
a21eccd
* Fri May 13 2016 John Dennis <jdennis@redhat.com> - 0.1-1
a21eccd
- Initial version