diff --git a/etckeeper.spec b/etckeeper.spec index 394ed7c..b7eecc0 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -4,20 +4,28 @@ %global with_bzr 1 %endif -%if 0%{?fedora} +%if (0%{?fedora} && 0%{?fedora} <= 30) || (0%{?rhel} && 0%{?rhel} <= 7) +%global with_yum 1 +%endif + +%if 0%{?fedora} || 0%{?rhel} >= 7 %global with_dnf 1 -%global dnf_is_mandatory 1 -%global dnf_uses_python3 1 %global with_systemd 1 +%global __markdown %{_bindir}/markdown_py +%global hostname_dep hostname +%else +%global __markdown %{_bindir}/markdown +%global hostname_dep net-tools %endif -%if 0%{?rhel} >= 7 -%global with_systemd 1 +%if 0%{?fedora} || 0%{?rhel} >= 8 +%global dnf_is_mandatory 1 +%global dnf_uses_python3 1 %endif Name: etckeeper Version: 1.18.10 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ @@ -27,20 +35,12 @@ Patch0: etckeeper-makefile-remove-python-plugins.patch Patch1: etckeeper-1.18.7-fix-rpm-ignores.patch Patch2: etckeeper-1.18.7-fix-hg-warnings.patch BuildArch: noarch -%if 0%{?fedora} || 0%{?rhel} >= 7 -BuildRequires: %{_bindir}/markdown_py -%else -BuildRequires: %{_bindir}/markdown -%endif +BuildRequires: %{__markdown} Requires: git >= 1.6.1 Requires: perl-interpreter Requires: crontabs Requires: findutils -%if 0%{?fedora} || 0%{?rhel} >= 7 -Requires: hostname -%else -Requires: net-tools -%endif +Requires: %{hostname_dep} Requires: which %if 0%{?dnf_is_mandatory} Requires: %{name}-dnf = %{version}-%{release} @@ -107,9 +107,13 @@ etckeeper with DNF, install this package. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%if 0%{?with_yum} # we set yum here, so the yum plugin gets built, and change that to # dnf later, if needed sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=yum|' \ +%else +sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=dnf|' \ +%endif # with_yum -e 's|LOWLEVEL_PACKAGE_MANAGER=.*|LOWLEVEL_PACKAGE_MANAGER=rpm|' \ -i etckeeper.conf sed -e 's|^prefix=.*|prefix=%{_prefix}|' \ @@ -123,7 +127,7 @@ sed -e 's|^prefix=.*|prefix=%{_prefix}|' \ %if 0%{?with_systemd} sed -e 's|^systemddir=.*|systemddir=%{_unitdir}|' \ -i Makefile -%endif +%endif # with_systemd # move each plugin in its own subdirectory, so each has its own build/ # directory mkdir bzr-plugin ; mv etckeeper-bzr bzr-plugin @@ -138,7 +142,7 @@ make %{?_smp_mflags} pushd bzr-plugin %{__python2} etckeeper-bzr/__init__.py build popd -%endif +%endif # with_bzr %if 0%{?with_dnf} pushd dnf-plugin @@ -146,16 +150,11 @@ pushd dnf-plugin %{__python3} etckeeper-dnf/etckeeper.py build --executable="%{__python3} -s" %else %{__python2} etckeeper-dnf/etckeeper.py build --executable="%{__python2} -s" -%endif +%endif # dnf_uses_python3 popd -%endif +%endif # with_dnf -%if 0%{?fedora} || 0%{?rhel} >= 7 -# the binary in python-markdown has been renamed -markdown_py -f README.html README.md -%else -markdown -f README.html README.md -%endif +%{__markdown} -f README.html README.md %install @@ -165,7 +164,7 @@ make install DESTDIR=%{buildroot} pushd bzr-plugin %{__python2} etckeeper-bzr/__init__.py install -O1 --skip-build --root %{buildroot} popd -%endif +%endif # with_bzr %if 0%{?with_dnf} pushd dnf-plugin @@ -173,14 +172,14 @@ pushd dnf-plugin %{__python3} etckeeper-dnf/etckeeper.py install -O1 --skip-build --root %{buildroot} %else %{__python2} etckeeper-dnf/etckeeper.py install -O1 --skip-build --root %{buildroot} -%endif +%endif # dnf_uses_python3 popd %if 0%{?dnf_is_mandatory} sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=dnf|' \ -i %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf -%endif -%endif +%endif # dnf_is_mandatory +%endif # with_dnf install -D -p debian/cron.daily %{buildroot}%{_sysconfdir}/cron.daily/%{name} install -d %{buildroot}%{_localstatedir}/cache/%{name} @@ -242,10 +241,12 @@ fi %dir %{_sysconfdir}/bash_completion.d %{_sysconfdir}/bash_completion.d/%{name} %endif +%if 0%{?with_yum} %dir %{_prefix}/lib/yum-plugins %{_prefix}/lib/yum-plugins/%{name}.* %dir %{_sysconfdir}/yum/pluginconf.d %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/%{name}.conf +%endif # with_yum %{_localstatedir}/cache/%{name} %if 0%{?with_systemd} %{_unitdir}/%{name}.service @@ -277,6 +278,10 @@ fi %changelog +* Fri Oct 4 2019 Thomas Moschny - 1.18.10-4 +- Package fixes for CentOS8. +- Build dnf plugin on CentOS7. + * Thu Oct 03 2019 Miro HronĨok - 1.18.10-3 - Rebuilt for Python 3.8.0rc1 (#1748018)