From 3c619c78d45690e7c192be22dfe8b951963eadba Mon Sep 17 00:00:00 2001 From: Alexander Scheel Date: Tue, 2 Mar 2021 10:50:46 -0500 Subject: [PATCH] Make spec file more distro-agnostic This allows the same Fedora srpm to be rebuild on the ELN, CentOS Stream and RHEL distributions. Change the test runner to tox since the user of pytest3-test-runner was dropped upstream. --- freeipa-healthcheck.spec | 44 ++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/freeipa-healthcheck.spec b/freeipa-healthcheck.spec index bd7df0e..f7b27d9 100644 --- a/freeipa-healthcheck.spec +++ b/freeipa-healthcheck.spec @@ -1,16 +1,25 @@ +%if 0%{?rhel} +%global project ipa +%global projectname IPA +%global alt_project freeipa +%else +# Fedora %global project freeipa %global projectname FreeIPA +%global alt_project ipa +%endif %global shortname healthcheck %global longname ipa%{shortname} %global debug_package %{nil} %global python3dir %{_builddir}/python3-%{name}-%{version}-%{release} %{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%global alt_name %{alt_project}-%{shortname} %bcond_without tests Name: %{project}-%{shortname} Version: 0.8 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Health check tool for %{projectname} BuildArch: noarch License: GPLv3 @@ -37,14 +46,19 @@ BuildRequires: python3-setuptools BuildRequires: systemd-devel %{?systemd_requires} # packages for make check -BuildRequires: python3-pytest-runner %if %{with tests} +BuildRequires: python3-tox +BuildRequires: python3-pytest BuildRequires: python3-ipalib BuildRequires: python3-ipaserver %endif BuildRequires: python3-lib389 BuildRequires: python3-libsss_nss_idmap +# Cross-provides for sibling OS +Provides: %{alt_name} = %{version} +Conflicts: %{alt_name} +Obsoletes: %{alt_name} < %{version} %description The FreeIPA health check tool provides a set of checks to @@ -54,14 +68,18 @@ proactively detect defects in a FreeIPA cluster. %package -n %{name}-core Summary: Core plugin system for healthcheck +# Cross-provides for sibling OS +Provides: %{alt_name}-core = %{version} +Conflicts: %{alt_name}-core +Obsoletes: %{alt_name}-core < %{version} + %description -n %{name}-core Core files %prep -%setup -n %{project}-%{shortname}-%{version} -%autosetup -p1 +%autosetup -p1 -n freeipa-%{shortname}-%{version} %build @@ -75,21 +93,21 @@ mkdir -p %{buildroot}%{_sysconfdir}/%{longname} install -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{longname} mkdir -p %{buildroot}/%{_unitdir} -install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/systemd/ipa-%{shortname}.service %{buildroot}%{_unitdir} -install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/systemd/ipa-%{shortname}.timer %{buildroot}%{_unitdir} +install -p -m644 %{_builddir}/freeipa-%{shortname}-%{version}/systemd/ipa-%{shortname}.service %{buildroot}%{_unitdir} +install -p -m644 %{_builddir}/freeipa-%{shortname}-%{version}/systemd/ipa-%{shortname}.timer %{buildroot}%{_unitdir} mkdir -p %{buildroot}/%{_libexecdir}/ipa -install -p -m755 %{_builddir}/%{project}-%{shortname}-%{version}/systemd/ipa-%{shortname}.sh %{buildroot}%{_libexecdir}/ipa/ +install -p -m755 %{_builddir}/freeipa-%{shortname}-%{version}/systemd/ipa-%{shortname}.sh %{buildroot}%{_libexecdir}/ipa/ mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d -install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/logrotate/%{longname} %{buildroot}%{_sysconfdir}/logrotate.d +install -p -m644 %{_builddir}/freeipa-%{shortname}-%{version}/logrotate/%{longname} %{buildroot}%{_sysconfdir}/logrotate.d mkdir -p %{buildroot}/%{_localstatedir}/log/ipa/%{shortname} mkdir -p %{buildroot}/%{_mandir}/man8 mkdir -p %{buildroot}/%{_mandir}/man5 -install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man8/ipa-%{shortname}.8 %{buildroot}%{_mandir}/man8/ -install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man5/%{longname}.conf.5 %{buildroot}%{_mandir}/man5/ +install -p -m644 %{_builddir}/freeipa-%{shortname}-%{version}/man/man8/ipa-%{shortname}.8 %{buildroot}%{_mandir}/man8/ +install -p -m644 %{_builddir}/freeipa-%{shortname}-%{version}/man/man5/%{longname}.conf.5 %{buildroot}%{_mandir}/man5/ (cd %{buildroot}/%{python3_sitelib}/ipahealthcheck && find . -type f | \ grep -v '^./core' | \ @@ -100,7 +118,7 @@ install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man5/%{long %if %{with tests} %check -%{__python3} setup.py test +tox -epy3 %endif @@ -141,6 +159,10 @@ install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man5/%{long %changelog +* Tue Mar 2 2021 Alexander Scheel - 0.8-5 +- Make the spec file more distribution-agnostic +- Use tox as the test runner when tests are enabled + * Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 0.8-4 - Rebuilt for updated systemd-rpm-macros See https://pagure.io/fesco/issue/2583.