%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} %global dnf_is_mandatory 1 Name: etckeeper Version: 1.18.20 Release: 1 Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ Source0: https://git.joeyh.name/index.cgi/etckeeper.git/snapshot/%{name}-%{version}.tar.gz Source2: cron.daily Patch0: etckeeper-makefile-remove-python-plugins.patch Patch1: etckeeper-1.18.7-fix-rpm-ignores.patch Patch2: etckeeper-1.18.18-fix-hg-warnings.patch # From https://bugs.launchpad.net/ubuntu/+source/etckeeper/+bug/1826855 Patch3: etckeeper-add-breezy-python3-plugin.patch # https://github.com/ansible/ansible/issues/54949 Patch4: etckeeper-1.18.18-fix-output-for-ansible.patch BuildArch: noarch BuildRequires: python3-markdown Requires: git >= 1.6.1 perl-interpreter crontabs findutils hostname which %if 0%{?dnf_is_mandatory} Requires: %{name}-dnf = %{version}-%{release} %endif BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %description The etckeeper program is a tool to let /etc be stored in a git, mercurial, bzr or darcs repository. It hooks into yum to automatically commit changes made to /etc during package upgrades. It tracks file metadata that version control systems do not normally support, but that is important for /etc, such as the permissions of /etc/shadow. It's quite modular and configurable, while also being simple to use if you understand the basics of working with version control. The default backend is git, if want to use a another backend please install the appropriate tool (mercurial, darcs or bzr). %{?bazaar: To use bazaar/breezy as backend, please also install the %{name}-%{bazaar} package.} To start using the package please read %{_pkgdocdir}/README. %if 0%{?with_brz} %package brz Summary: Support for bzr with etckeeper (via breezy) BuildRequires: python3-devel brz Requires: %{name} = %{version}-%{release} brz %description brz This package provides a brz (breezy) backend for etckeeper, if you want to use etckeeper with (bzr) bazaar repositories, install this package. %endif %package dnf Summary: DNF plugin for etckeeper support BuildRequires: python3-devel BuildRequires: dnf dnf-plugins-core make Requires: %{name} = %{version}-%{release} dnf dnf-plugins-core %description dnf This package provides a DNF plugin for etckeeper. If you want to use etckeeper with DNF, install this package. %prep %autosetup -p1 %if 0%{?with_yum} sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=yum|' \ %else sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=dnf|' \ %endif -e 's|LOWLEVEL_PACKAGE_MANAGER=.*|LOWLEVEL_PACKAGE_MANAGER=rpm|' \ -i etckeeper.conf sed -e 's|^prefix=.*|prefix=%{_prefix}|' \ -e 's|^bindir=.*|bindir=%{_bindir}|' \ -e 's|^etcdir=.*|etcdir=%{_sysconfdir}|' \ -e 's|^mandir=.*|mandir=%{_mandir}|' \ -e 's|^vardir=.*|vardir=%{_localstatedir}|' \ -e 's|^INSTALL=.*|INSTALL=install -p|' \ -e 's|^CP=.*|CP=cp -pR|' \ -e 's|^systemddir=.*|systemddir=%{_unitdir}|' \ -i Makefile mkdir brz-plugin ; mv etckeeper-brz brz-plugin mkdir dnf-plugin ; mv etckeeper-dnf dnf-plugin %build %make_build %if 0%{?with_brz} pushd brz-plugin %define py_setup etckeeper-brz/__init__.py %py3_build popd %endif pushd dnf-plugin %define py_setup etckeeper-dnf/etckeeper.py build %py3_build popd `ls /usr/bin/ |grep "markdown"` -f README.html README.md %install %make_install %if 0%{?with_brz} pushd brz-plugin %define py_setup etckeeper-brz/__init__.py %py3_install popd %endif pushd dnf-plugin %define py_setup etckeeper-dnf/etckeeper.py build %py3_install popd %if 0%{?dnf_is_mandatory} sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=dnf|' \ -i %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf %endif install -D -p %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.daily/%{name} install -d %{buildroot}%{_localstatedir}/cache/%{name} %post if [ $1 -gt 1 ] ; then %{_bindir}/%{name} update-ignore fi %systemd_post %{name}.service %systemd_post %{name}.timer %preun %systemd_preun %{name}.service %systemd_preun %{name}.timer %postun %systemd_postun %{name}.service %systemd_postun %{name}.timer %files %doc README.html README.md %license GPL %{_bindir}/%{name} %{_mandir}/man8/%{name}.8* %dir %{_sysconfdir}/%{name} %{_sysconfdir}/%{name}/*.d %{_sysconfdir}/%{name}/daily %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %{_sysconfdir}/cron.daily/%{name} %dir %{_datadir}/bash-completion %dir %{_datadir}/bash-completion/completions %{_datadir}/bash-completion/completions/%{name} %dir %{_datadir}/zsh %dir %{_datadir}/zsh/vendor-completions %{_datadir}/zsh/vendor-completions/_%{name} %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 %{_localstatedir}/cache/%{name} %{_unitdir}/%{name}.service %{_unitdir}/%{name}.timer %if 0%{?with_brz} %files brz %dir %{python3_sitelib}/breezy/ %dir %{python3_sitelib}/breezy/plugins/ %{python3_sitelib}/breezy/plugins/%{name}/ %{python3_sitelib}/brz_%{name}-*.egg-info %endif %files dnf %{python3_sitelib}/dnf-plugins/%{name}.py %exclude %{python3_sitelib}/dnf-plugins/__init__.py %{python3_sitelib}/dnf-plugins/__pycache__/%{name}.* %exclude %{python3_sitelib}/dnf-plugins/__pycache__/__init__.* %{python3_sitelib}/dnf_%{name}-*.egg-info %changelog * Fri Apr 21 2023 wangkai <13474090681@163.com> - 1.18.20-1 - Update to 1.18.20 * Tue Sep 7 2021 zhengyaohui - 1.18.16-1 - package init