From 9d8abcaa583e0807caeec1ecd58fd68616092eac Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Thu, 3 Oct 2019 08:58:58 -0500 Subject: [PATCH 01/18] "Adding package.cfg file" --- package.cfg | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 package.cfg diff --git a/package.cfg b/package.cfg new file mode 100644 index 0000000..66ea79d --- /dev/null +++ b/package.cfg @@ -0,0 +1,2 @@ +[koji] +targets = epel8 epel8-playground \ No newline at end of file From dff014d9923d227cbe65a495fe447e0161c91d81 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Thu, 3 Oct 2019 17:25:48 +0200 Subject: [PATCH 02/18] Import from current master. --- .cvsignore | 0 .gitignore | 2 + Makefile | 21 - README.fedora | 21 + etckeeper-1.18.7-fix-hg-warnings.patch | 34 ++ etckeeper-1.18.7-fix-rpm-ignores.patch | 14 + ...eeper-makefile-remove-python-plugins.patch | 32 + etckeeper.spec | 549 ++++++++++++++++++ sources | 1 + 9 files changed, 653 insertions(+), 21 deletions(-) delete mode 100644 .cvsignore create mode 100644 .gitignore delete mode 100644 Makefile create mode 100644 README.fedora create mode 100644 etckeeper-1.18.7-fix-hg-warnings.patch create mode 100644 etckeeper-1.18.7-fix-rpm-ignores.patch create mode 100644 etckeeper-makefile-remove-python-plugins.patch create mode 100644 etckeeper.spec diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..171ced7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/etckeeper_*.tar.gz +/etckeeper-*.tar.gz diff --git a/Makefile b/Makefile deleted file mode 100644 index cc88086..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: etckeeper -# $Id$ -NAME := etckeeper -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/README.fedora b/README.fedora new file mode 100644 index 0000000..04c7011 --- /dev/null +++ b/README.fedora @@ -0,0 +1,21 @@ +*Please* read the included README, so you understand the security +aspects, and how it all works. + +For the impatient: Run + + etckeeper init + etckeeper vcs status + etckeeper vcs commit -m 'msg' + +to get etckeeper started. + +Once you do that, the cronjob is in place and it'll do daily +autocommits for you. To disable it, set AVOID_DAILY_AUTOCOMMITS=1 in +/etc/etckeeper/etckeeper.conf. + +There's a yum plugin enabled that autocommits before and after each +yum transaction. A dnf plugin is also included, in the subpackage +etckeeper-dnf. + +The yum plugin can be disabled in +/etc/yum/pluginconf.d/etckeeper.conf. diff --git a/etckeeper-1.18.7-fix-hg-warnings.patch b/etckeeper-1.18.7-fix-hg-warnings.patch new file mode 100644 index 0000000..90c6818 --- /dev/null +++ b/etckeeper-1.18.7-fix-hg-warnings.patch @@ -0,0 +1,34 @@ +diff --git a/pre-commit.d/20warn-problem-files b/pre-commit.d/20warn-problem-files +index 6bd5c2b..7899268 100755 +--- a/pre-commit.d/20warn-problem-files ++++ b/pre-commit.d/20warn-problem-files +@@ -1,19 +1,20 @@ + #!/bin/sh + set -e + +-exclude_internal () { +- egrep -v '(^|/)(\.git|\.hg|\.bzr|_darcs)/' +-} ++# (Note that when using this, the find expression must end with ++# -print or -exec, else the excluded directories will actually be ++# printed!) ++NOVCS='. -path ./.git -prune -o -path ./.bzr -prune -o -path ./.hg -prune -o -path ./_darcs -prune -o' + + if [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then +- special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true +- hardlinks=$(find . -type f ! -links 1 | exclude_internal ) || true ++ special=$(find $NOVCS ! -type d ! -type f ! -type l -print) || true ++ hardlinks=$(find $NOVCS -type f ! -links 1 -print) || true + elif [ "$VCS" = hg ]; then +- special=$(find . ! -type d ! -type f ! -type l | exclude_internal) || true +- hardlinks=$(find . -type f ! -links 1 -exec hg status {} \; | exclude_internal ) || true ++ special=$(find $NOVCS ! -type d ! -type f ! -type l -print) || true ++ hardlinks=$(find $NOVCS -type f ! -links 1 -exec hg status {} \; -print) || true + elif [ "$VCS" = git ]; then +- special=$(find . ! -type d ! -type f ! -type l -exec git ls-files --exclude-standard --cached --others {} + | exclude_internal) || true +- hardlinks=$(find . -type f ! -links 1 -exec git ls-files --exclude-standard --cached --others {} + | exclude_internal) || true ++ special=$(find $NOVCS ! -type d ! -type f ! -type l -exec git ls-files --exclude-standard --cached --others {} + -print) || true ++ hardlinks=$(find $NOVCS -type f ! -links 1 -exec git ls-files --exclude-standard --cached --others {} + -print) || true + else + special="" + fi diff --git a/etckeeper-1.18.7-fix-rpm-ignores.patch b/etckeeper-1.18.7-fix-rpm-ignores.patch new file mode 100644 index 0000000..1cb5fed --- /dev/null +++ b/etckeeper-1.18.7-fix-rpm-ignores.patch @@ -0,0 +1,14 @@ +diff -up etckeeper-1.18.7/update-ignore.d/01update-ignore.orig etckeeper-1.18.7/update-ignore.d/01update-ignore +--- etckeeper-1.18.7/update-ignore.d/01update-ignore.orig 2017-08-13 12:31:57.360734395 +0200 ++++ etckeeper-1.18.7/update-ignore.d/01update-ignore 2017-08-13 12:32:45.246242478 +0200 +@@ -91,7 +91,9 @@ writefile () { + nl + elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "rpm" ]; then + comment "new and old versions of conffiles, stored by apt/rpm" +- ignore "*.rpm*" ++ ignore "*.rpmnew" ++ ignore "*.rpmorig" ++ ignore "*.rpmsave" + nl + elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "pacman-g2" -o "$LOWLEVEL_PACKAGE_MANAGER" = "pacman" -o "$LOWLEVEL_PACKAGE_MANAGER" = "pacmatic" ]; then + comment "new and old versions of conffiles, stored by pacman" diff --git a/etckeeper-makefile-remove-python-plugins.patch b/etckeeper-makefile-remove-python-plugins.patch new file mode 100644 index 0000000..7ed0de8 --- /dev/null +++ b/etckeeper-makefile-remove-python-plugins.patch @@ -0,0 +1,32 @@ +diff -up etckeeper-1.18.7/Makefile.orig etckeeper-1.18.7/Makefile +--- etckeeper-1.18.7/Makefile.orig 2017-06-08 18:59:32.000000000 +0200 ++++ etckeeper-1.18.7/Makefile 2017-06-12 22:58:50.802133039 +0200 +@@ -15,13 +15,10 @@ CP=cp -R + INSTALL=install + INSTALL_EXE=${INSTALL} + INSTALL_DATA=${INSTALL} -m 0644 +-PYTHON=python + FAKEROOT := $(shell command -v fakeroot 2> /dev/null) + TESTDIR := $(shell mktemp -u -d) + + build: etckeeper.spec etckeeper.version +- -$(PYTHON) ./etckeeper-bzr/__init__.py build || echo "** bzr support not built" +- -$(PYTHON) ./etckeeper-dnf/etckeeper.py build || echo "** DNF support not built" + + install: etckeeper.version + mkdir -p $(DESTDIR)$(etcdir)/etckeeper/ $(DESTDIR)$(vardir)/cache/etckeeper/ +@@ -58,14 +55,10 @@ ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),yum) + mkdir -p $(DESTDIR)$(etcdir)/yum/pluginconf.d + $(INSTALL_DATA) yum-etckeeper.conf $(DESTDIR)$(etcdir)/yum/pluginconf.d/etckeeper.conf + endif +-ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),dnf) +- -$(PYTHON) ./etckeeper-dnf/etckeeper.py install --root=$(DESTDIR) ${PYTHON_INSTALL_OPTS} || echo "** DNF support not installed" +-endif + ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),zypper) + mkdir -p $(DESTDIR)$(prefix)/lib/zypp/plugins/commit + $(INSTALL) zypper-etckeeper.py $(DESTDIR)$(prefix)/lib/zypp/plugins/commit/zypper-etckeeper.py + endif +- -$(PYTHON) ./etckeeper-bzr/__init__.py install --root=$(DESTDIR) ${PYTHON_INSTALL_OPTS} || echo "** bzr support not installed" + echo "** installation successful" + + clean: etckeeper.spec etckeeper.version diff --git a/etckeeper.spec b/etckeeper.spec new file mode 100644 index 0000000..394ed7c --- /dev/null +++ b/etckeeper.spec @@ -0,0 +1,549 @@ +%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} + +%if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} <= 7) +%global with_bzr 1 +%endif + +%if 0%{?fedora} +%global with_dnf 1 +%global dnf_is_mandatory 1 +%global dnf_uses_python3 1 +%global with_systemd 1 +%endif + +%if 0%{?rhel} >= 7 +%global with_systemd 1 +%endif + +Name: etckeeper +Version: 1.18.10 +Release: 3%{?dist} +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 +Source1: README.fedora +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 +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: which +%if 0%{?dnf_is_mandatory} +Requires: %{name}-dnf = %{version}-%{release} +%endif # dnf_is_mandatory +%if 0%{?with_systemd} +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%endif # with_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). +To use bzr as backend, please also install the %{name}-bzr package. + +To start using the package please read %{_pkgdocdir}/README. + + +%if 0%{?with_bzr} +%package bzr +Summary: Support for bzr with etckeeper +BuildRequires: python2-devel +BuildRequires: bzr +Requires: %{name} = %{version}-%{release} +Requires: bzr + +%description bzr +This package provides a bzr backend for etckeeper, if you want to use +etckeeper with bzr backend, install this package. +%endif # with_bzr + + +%if 0%{?with_dnf} +%package dnf +Summary: DNF plugin for etckeeper support +%if 0%{?dnf_uses_python3} +BuildRequires: python3-devel +%else +BuildRequires: python2-devel +%endif # dnf_uses_python3 +BuildRequires: dnf +BuildRequires: dnf-plugins-core +Requires: %{name} = %{version}-%{release} +Requires: dnf +Requires: dnf-plugins-core + +%description dnf +This package provides a DNF plugin for etckeeper. If you want to use +etckeeper with DNF, install this package. +%endif # with_dnf + + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +# 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|' \ + -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|' \ + -i Makefile +%if 0%{?with_systemd} +sed -e 's|^systemddir=.*|systemddir=%{_unitdir}|' \ + -i Makefile +%endif +# move each plugin in its own subdirectory, so each has its own build/ +# directory +mkdir bzr-plugin ; mv etckeeper-bzr bzr-plugin +mkdir dnf-plugin ; mv etckeeper-dnf dnf-plugin +cp -av %{SOURCE1} . + + +%build +make %{?_smp_mflags} + +%if 0%{?with_bzr} +pushd bzr-plugin +%{__python2} etckeeper-bzr/__init__.py build +popd +%endif + +%if 0%{?with_dnf} +pushd dnf-plugin +%if 0%{?dnf_uses_python3} +%{__python3} etckeeper-dnf/etckeeper.py build --executable="%{__python3} -s" +%else +%{__python2} etckeeper-dnf/etckeeper.py build --executable="%{__python2} -s" +%endif +popd +%endif + +%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 + + +%install +make install DESTDIR=%{buildroot} + +%if 0%{?with_bzr} +pushd bzr-plugin +%{__python2} etckeeper-bzr/__init__.py install -O1 --skip-build --root %{buildroot} +popd +%endif + +%if 0%{?with_dnf} +pushd dnf-plugin +%if 0%{?dnf_uses_python3} +%{__python3} etckeeper-dnf/etckeeper.py install -O1 --skip-build --root %{buildroot} +%else +%{__python2} etckeeper-dnf/etckeeper.py install -O1 --skip-build --root %{buildroot} +%endif +popd + +%if 0%{?dnf_is_mandatory} +sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=dnf|' \ + -i %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf +%endif +%endif + +install -D -p debian/cron.daily %{buildroot}%{_sysconfdir}/cron.daily/%{name} +install -d %{buildroot}%{_localstatedir}/cache/%{name} + +# on RHEL < 7, move the completion file back to /etc/bash_completion.d +%if !(0%{?fedora} || 0%{?rhel} >= 7) +install -d %{buildroot}%{_sysconfdir}/bash_completion.d +mv %{buildroot}%{_datadir}/bash-completion/completions/%{name} \ + %{buildroot}%{_sysconfdir}/bash_completion.d/%{name} +%endif + +# remove unit files if not used (note: /lib/systemd/system is the +# original, hardcoded location from the etckeeper Makefile) +%if !0%{?with_systemd} +rm %{buildroot}/lib/systemd/system/%{name}.service +rm %{buildroot}/lib/systemd/system/%{name}.timer +%endif + + +%post +if [ $1 -gt 1 ] ; then + %{_bindir}/%{name} update-ignore +fi +%if 0%{?with_systemd} +%systemd_post %{name}.service +%systemd_post %{name}.timer +%endif # with_systemd + + +%preun +%if 0%{?with_systemd} +%systemd_preun %{name}.service +%systemd_preun %{name}.timer +%endif # with_systemd + + +%postun +%if 0%{?with_systemd} +%systemd_postun %{name}.service +%systemd_postun %{name}.timer +%endif # with_systemd + + +%files +%doc README.html README.fedora +%license GPL +%{_bindir}/%{name} +%{_mandir}/man8/%{name}.8* +%dir %{_sysconfdir}/%{name} +%{_sysconfdir}/%{name}/*.d +%{_sysconfdir}/%{name}/daily +%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf +%{_sysconfdir}/cron.daily/%{name} +%if 0%{?fedora} || 0%{?rhel} >= 7 +%dir %{_datadir}/bash-completion +%dir %{_datadir}/bash-completion/completions +%{_datadir}/bash-completion/completions/%{name} +%else +%dir %{_sysconfdir}/bash_completion.d +%{_sysconfdir}/bash_completion.d/%{name} +%endif +%dir %{_prefix}/lib/yum-plugins +%{_prefix}/lib/yum-plugins/%{name}.* +%dir %{_sysconfdir}/yum/pluginconf.d +%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/%{name}.conf +%{_localstatedir}/cache/%{name} +%if 0%{?with_systemd} +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.timer +%endif # with_systemd + + +%if 0%{?with_bzr} +%files bzr +%{python2_sitelib}/bzrlib/plugins/%{name} +%{python2_sitelib}/bzr_%{name}-*.egg-info +%endif # with_bzr + + +%if 0%{?with_dnf} +%files dnf +%if 0%{?dnf_uses_python3} +%{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 +%else +%{python2_sitelib}/dnf-plugins/%{name}.py* +%exclude %{python2_sitelib}/dnf-plugins/__init__.py* +%{python2_sitelib}/dnf_%{name}-*.egg-info +%endif # dnf_uses_python3 +%endif # with_dnf + + +%changelog +* Thu Oct 03 2019 Miro Hrončok - 1.18.10-3 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Thu Oct 3 2019 Thomas Moschny - 1.18.10-2 +- There is currently no bzr for rhel8. + +* Thu Oct 3 2019 Thomas Moschny - 1.18.10-1 +- Update to 1.18.10. + +* Mon Aug 19 2019 Miro Hrončok - 1.18.8-4 +- Rebuilt for Python 3.8 + +* Wed Jul 24 2019 Fedora Release Engineering - 1.18.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering - 1.18.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jul 16 2018 Thomas Moschny - 1.18.8-1 +- Update to 1.18.8. +- Update URL: and Source: tags. + +* Fri Jul 13 2018 Fedora Release Engineering - 1.18.7-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 1.18.7-4 +- Rebuilt for Python 3.7 + +* Mon May 14 2018 Thomas Moschny - 1.18.7-3 +- Use correct Requires: for the hostname cmd on EPEL6. + +* Sat Apr 21 2018 Thomas Moschny - 1.18.7-2 +- DNF is no longer available in EPEL7. + +* Sat Apr 21 2018 Thomas Moschny - 1.18.7-1 +- Update to 1.18.7. +- Rebase patches. +- Slightly modernize spec file. +- Update Python dependencies. +- Fix ignore rules (rhbz#1460461). +- Update README.fedora (rhbz#1478655). +- Add missing BRs (rhbz#1418790). +- Add patch to prevent mercurial warnings (rhbz#1480843). + +* Wed Feb 07 2018 Iryna Shcherbina - 1.18.5-7 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Wed Feb 07 2018 Fedora Release Engineering - 1.18.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.18.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu Jul 13 2017 Petr Pisar - 1.18.5-4 +- perl dependency renamed to perl-interpreter + + +* Fri Feb 10 2017 Fedora Release Engineering - 1.18.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 1.18.5-2 +- Rebuild for Python 3.6 + +* Tue Aug 23 2016 Thomas Moschny - 1.18.5-1 +- Update to 1.18.5. + +* Tue Jul 19 2016 Fedora Release Engineering - 1.18.3-3 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Wed Mar 2 2016 Thomas Moschny - 1.18.3-2 +- Move completion file back to /etc/bash_completion.d on EPEL<7. + +* Mon Feb 22 2016 Thomas Moschny - 1.18.3-1 +- Update to 1.18.3. +- Bash completions have been moved to /usr/share/bash-completion. + +* Wed Feb 3 2016 Thomas Moschny - 1.18.2-4 +- Do not own /etc/bash_completion.d on Fedora and EPEL>=7. +- Drop %%defattr. + +* Wed Feb 03 2016 Fedora Release Engineering - 1.18.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Fedora Release Engineering - 1.18.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Sat Oct 24 2015 Thomas Moschny - 1.18.2-1 +- Update to etckeeper 1.18.2. +- Depend on dnf for F22+ (rhbz#1229131). +- Minor changelog fixes. + +* Wed Jun 17 2015 Fedora Release Engineering - 1.18.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Apr 23 2015 Thomas Moschny - 1.18.1-2 +- Fix HTML generation from markdown (rhbz#1213776). + +* Thu Mar 26 2015 Thomas Moschny - 1.18.1-1 +- Update to 1.18.1. +- Add missing dependency on python3-devel for dnf plugin on F23+. + +* Fri Mar 20 2015 Thomas Moschny - 1.18-1 +- Update to 1.18. +- Update upstream URLs. +- Package DNF plugin. +- Slightly modernize spec file. + +* Thu Dec 18 2014 Thomas Moschny - 1.14-2 +- Disable bzr plugin on epel5. + +* Fri Sep 5 2014 Thomas Moschny - 1.14-1 +- Update to 1.14. + +* Fri Aug 15 2014 Thomas Moschny - 1.13-1 +- Update to 1.13. + +* Sun Jun 22 2014 Thomas Moschny - 1.12-1 +- Update to 1.12. +- Format README.md. + +* Sat Jun 07 2014 Fedora Release Engineering - 1.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu Dec 19 2013 Thomas Moschny - 1.11-1 +- Update to 1.11. + +* Sat Nov 9 2013 Thomas Moschny - 1.10-1 +- Update to 1.10. + +* Thu Sep 12 2013 Thomas Moschny - 1.9-1 +- Update to 1.9. + +* Sun Aug 18 2013 Thomas Moschny - 1.7-1 +- Update to 1.7. +- Define (if undefined) and use _pkgdocdir macro (rhbz#993741). + +* Tue Jul 30 2013 Thomas Moschny - 1.6-1 +- Update to 1.6. + +* Sat Jul 27 2013 Thomas Moschny - 1.5-1 +- Update to 1.5. + +* Sat Jul 27 2013 Jóhann B. Guðmundsson - 1.4-2 +- Add a missing requirement on crontabs to spec file + +* Sun Jun 23 2013 Thomas Moschny - 1.4-1 +- Update to 1.4. + +* Fri May 10 2013 Thomas Moschny - 1.3-1 +- Update to 1.3. + +* Wed Feb 13 2013 Fedora Release Engineering - 0.64-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Sep 23 2012 Thomas Moschny - 0.64-1 +- Update to 0.64. + +* Thu Jul 19 2012 Fedora Release Engineering - 0.63-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jun 4 2012 Thomas Moschny - 0.63-1 +- Update to 0.63. + +* Tue Mar 13 2012 Thomas Moschny - 0.62-2 +- Add missing dependency on perl (bz 798563). + +* Tue Mar 13 2012 Thomas Moschny - 0.62-1 +- Update to 0.62. + +* Tue Jan 17 2012 Thomas Moschny - 0.61-1 +- Update to 0.61. + +* Fri Jan 13 2012 Thomas Moschny - 0.60-1 +- Update to 0.60. + +* Fri Jan 13 2012 Fedora Release Engineering - 0.58-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Dec 1 2011 Thomas Moschny - 0.58-1 +- Update to 0.58. + +* Wed Nov 9 2011 Thomas Moschny - 0.57-1 +- Update to 0.57. + +* Wed Aug 17 2011 Thomas Moschny - 0.56-2 +- Rebuilt for trailing slash bug of rpm-4.9.1 + +* Thu Jul 21 2011 Thomas Moschny - 0.56-1 +- Update to 0.56. + +* Fri Jun 24 2011 Thomas Moschny - 0.55-1 +- Update to 0.55. + +* Wed Jun 1 2011 Thomas Moschny - 0.54-1 +- Update to 0.54. +- Add patch for bz 709487. + +* Mon Mar 28 2011 Thomas Moschny - 0.53-1 +- Update to 0.53. +- Run update-ignore on package upgrade (bz 680632). + +* Wed Feb 9 2011 Thomas Moschny - 0.52-1 +- Update to 0.52. +- Include a README.fedora (bz 670934). + +* Tue Feb 08 2011 Fedora Release Engineering - 0.51-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 3 2011 Thomas Moschny - 0.51-1 +- Update to 0.51. +- etckeeper has been moved out of sbin. + +* Sat Dec 11 2010 Thomas Moschny - 0.50-2 +- Don't package INSTALL. + +* Wed Oct 27 2010 Thomas Moschny - 0.50-1 +- Update to 0.50. +- Change %%define -> %%global. + +* Fri Sep 17 2010 Thomas Moschny - 0.49-2 +- Adjust minimum required version of GIT. +- egg-info files are not created automatically on RHEL5. + +* Wed Sep 15 2010 Thomas Moschny - 0.49-1 +- Update to 0.49. +- Remove obsolete patch. + +* Fri Sep 3 2010 Thomas Moschny - 0.48-1 +- Update to 0.48. +- Don't list /etc/etckeeper/*.d directories twice in %%files. +- Add patch from upstream that fixes bz 588086. + +* Wed Jul 21 2010 David Malcolm - 0.41-2 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Sat Sep 12 2009 Bernie Innocenti - 0.41-1 +- Update to 0.41 +- Add missing directory ownerships + +* Sat Sep 12 2009 Bernie Innocenti - 0.40-3 +- Make the bzr subpackage builddepend on python-devel + +* Wed Sep 09 2009 Terje Rosten - 0.40-2 +- Package is noarch +- Rpmlint clean +- Random cleanup +- Ship cache dir in package +- bzr subpackage +- Add bzr to buildreq + +* Sat Sep 05 2009 Bernie Innocenti - 0.40-1 +- Update to 0.40 + +* Sun Jun 14 2009 Bernie Innocenti - 0.37-1 +- Update to 0.37 +- Change license tag to GPLv2+ + +* Fri Feb 27 2009 Jimmy Tang - 0.33-4 +- fix up initial install to make directory in /var/cache/etckeeper +- install the etckeeper daily cron job +- define some config files that shouldn't be replaced, should the hooks +in commit.d, init.d etc... saved and not blown away? if so they can +defined as config files. etckeeper should record the changes anyway. + +* Wed Feb 25 2009 Jimmy Tang - 0.32-1 +- yum etckeeper plugin is now apart of this package + +* Tue Feb 24 2009 Jimmy Tang - 0.31-1 +- initial package diff --git a/sources b/sources index e69de29..033b121 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (etckeeper-1.18.10.tar.gz) = 57eb91823c37f364e7ade6b25d2ab91fc99d1192a606fd09370c2876a0440120a625f30167fc52fb16b53ef9f7a58a1329bfe9567cbc2c91da06a345ebbe8e05 From ee57611c038e1e6bae019d1500bc25dbb267e35d Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Fri, 4 Oct 2019 22:00:00 +0200 Subject: [PATCH 03/18] Package fixes for CentOS8. Build dnf plugin on CentOS7. --- etckeeper.spec | 67 +++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 31 deletions(-) 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} -%global with_dnf 1 -%global dnf_is_mandatory 1 -%global dnf_uses_python3 1 -%global with_systemd 1 +%if (0%{?fedora} && 0%{?fedora} <= 30) || (0%{?rhel} && 0%{?rhel} <= 7) +%global with_yum 1 %endif -%if 0%{?rhel} >= 7 +%if 0%{?fedora} || 0%{?rhel} >= 7 +%global with_dnf 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%{?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) From 601adf7ddb106291ec77338642ea66594d0d35b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 1 Nov 2019 09:42:08 +0100 Subject: [PATCH 04/18] Add breezy plugin on Fedora 31+ - Remove bazaar plugin on Fedora 32+ - https://fedoraproject.org/wiki/Changes/ReplaceBazaarWithBreezy - https://bugzilla.redhat.com/show_bug.cgi?id=1741027 --- etckeeper-add-breezy-python3-plugin.patch | 52 ++++++++++++++++++++ etckeeper.spec | 60 +++++++++++++++++++++-- 2 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 etckeeper-add-breezy-python3-plugin.patch diff --git a/etckeeper-add-breezy-python3-plugin.patch b/etckeeper-add-breezy-python3-plugin.patch new file mode 100644 index 0000000..d234bef --- /dev/null +++ b/etckeeper-add-breezy-python3-plugin.patch @@ -0,0 +1,52 @@ +From b5919d7919dda614c3c3c76ba126f45e205494bd Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Mon, 29 Apr 2019 14:11:09 +0100 +Subject: [PATCH 1/3] Add breezy python3 plugin + +--- + Makefile | 3 +++ + debian/changelog | 6 ++++++ + debian/control | 6 +++--- + etckeeper-brz/__init__.py | 34 ++++++++++++++++++++++++++++++++++ + 4 files changed, 46 insertions(+), 3 deletions(-) + create mode 100644 etckeeper-brz/__init__.py + +Index: etckeeper-1.18.10/etckeeper-brz/__init__.py +=================================================================== +--- /dev/null ++++ etckeeper-1.18.10/etckeeper-brz/__init__.py +@@ -0,0 +1,34 @@ ++# ++# Breezy plugin that runs etckeeper pre-commit when necessary ++ ++"""Runs etckeeper pre-commit when necessary.""" ++ ++from breezy.errors import BzrError ++import os ++ ++def etckeeper_startcommit_hook(tree): ++ abspath = getattr(tree, "abspath", None) ++ if abspath is None or not os.path.exists(abspath(".etckeeper")): ++ # Only run the commit hook when this is an etckeeper branch ++ return ++ import subprocess ++ ret = subprocess.call(["etckeeper", "pre-commit", abspath(".")]) ++ if ret != 0: ++ raise BzrError("etckeeper pre-commit failed") ++ ++try: ++ from breezy.hooks import install_lazy_named_hook ++except ImportError: ++ from breezy.mutabletree import MutableTree ++ MutableTree.hooks.install_named_hook('start_commit', ++ etckeeper_startcommit_hook, 'etckeeper') ++else: ++ install_lazy_named_hook( ++ "breezy.mutabletree", "MutableTree.hooks", ++ 'start_commit', etckeeper_startcommit_hook, 'etckeeper') ++ ++if __name__ == "__main__": ++ from distutils.core import setup ++ setup(name="brz-etckeeper", ++ packages=["breezy.plugins.etckeeper"], ++ package_dir={"breezy.plugins.etckeeper":"etckeeper-brz"}) diff --git a/etckeeper.spec b/etckeeper.spec index b7eecc0..e1a467b 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -1,9 +1,17 @@ %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} -%if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} <= 7) +%if (0%{?fedora} && 0%{?fedora} < 32) || (0%{?rhel} && 0%{?rhel} <= 7) %global with_bzr 1 %endif +%if 0%{?fedora} >= 31 +%global with_brz 1 +# this is used to mention the correct package in descriptions +%global bazaar brz +%else +%global bazaar bzr +%endif + %if (0%{?fedora} && 0%{?fedora} <= 30) || (0%{?rhel} && 0%{?rhel} <= 7) %global with_yum 1 %endif @@ -25,7 +33,7 @@ Name: etckeeper Version: 1.18.10 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ @@ -34,6 +42,8 @@ Source1: README.fedora 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 +# From https://bugs.launchpad.net/ubuntu/+source/etckeeper/+bug/1826855 +Patch3: etckeeper-add-breezy-python3-plugin.patch BuildArch: noarch BuildRequires: %{__markdown} Requires: git >= 1.6.1 @@ -63,7 +73,7 @@ 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). -To use bzr as backend, please also install the %{name}-bzr package. +To use bzr as backend, please also install the %{name}-%{bazaar} package. To start using the package please read %{_pkgdocdir}/README. @@ -82,6 +92,20 @@ etckeeper with bzr backend, install this package. %endif # with_bzr +%if 0%{?with_brz} +%package brz +Summary: Support for bzr with etckeeper (via breezy) +BuildRequires: python3-devel +BuildRequires: brz +Requires: %{name} = %{version}-%{release} +Requires: 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 # with_brz + + %if 0%{?with_dnf} %package dnf Summary: DNF plugin for etckeeper support @@ -107,6 +131,7 @@ etckeeper with DNF, install this package. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %if 0%{?with_yum} # we set yum here, so the yum plugin gets built, and change that to # dnf later, if needed @@ -131,6 +156,7 @@ sed -e 's|^systemddir=.*|systemddir=%{_unitdir}|' \ # move each plugin in its own subdirectory, so each has its own build/ # directory mkdir bzr-plugin ; mv etckeeper-bzr bzr-plugin +mkdir brz-plugin ; mv etckeeper-brz brz-plugin mkdir dnf-plugin ; mv etckeeper-dnf dnf-plugin cp -av %{SOURCE1} . @@ -144,6 +170,12 @@ pushd bzr-plugin popd %endif # with_bzr +%if 0%{?with_brz} +pushd brz-plugin +%{__python3} etckeeper-brz/__init__.py build +popd +%endif # with_brz + %if 0%{?with_dnf} pushd dnf-plugin %if 0%{?dnf_uses_python3} @@ -166,6 +198,12 @@ pushd bzr-plugin popd %endif # with_bzr +%if 0%{?with_brz} +pushd brz-plugin +%{__python3} etckeeper-brz/__init__.py install -O1 --skip-build --root %{buildroot} +popd +%endif # with_brz + %if 0%{?with_dnf} pushd dnf-plugin %if 0%{?dnf_uses_python3} @@ -261,6 +299,17 @@ fi %endif # with_bzr +%if 0%{?with_brz} +%files brz +# co-own the plugins directories +# breezy installs to sitearch +%dir %{python3_sitelib}/breezy/ +%dir %{python3_sitelib}/breezy/plugins/ +%{python3_sitelib}/breezy/plugins/%{name}/ +%{python3_sitelib}/brz_%{name}-*.egg-info +%endif # with_brz + + %if 0%{?with_dnf} %files dnf %if 0%{?dnf_uses_python3} @@ -278,6 +327,11 @@ fi %changelog +* Fri Nov 01 2019 Miro Hrončok - 1.18.10-5 +- Add breezy plugin on Fedora 31+ +- Remove bazaar plugin on Fedora 32+ +- https://fedoraproject.org/wiki/Changes/ReplaceBazaarWithBreezy + * Fri Oct 4 2019 Thomas Moschny - 1.18.10-4 - Package fixes for CentOS8. - Build dnf plugin on CentOS7. From 5244985ead36df0852e011f1864a0f0a14fcbfd2 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sun, 17 Nov 2019 11:31:18 +0100 Subject: [PATCH 05/18] Add patch to fix logging with Ansible (#1762693). --- ...eeper-1.18.10-fix-output-for-ansible.patch | 189 ++++++++++++++++++ etckeeper.spec | 16 +- 2 files changed, 199 insertions(+), 6 deletions(-) create mode 100644 etckeeper-1.18.10-fix-output-for-ansible.patch diff --git a/etckeeper-1.18.10-fix-output-for-ansible.patch b/etckeeper-1.18.10-fix-output-for-ansible.patch new file mode 100644 index 0000000..b1d0a65 --- /dev/null +++ b/etckeeper-1.18.10-fix-output-for-ansible.patch @@ -0,0 +1,189 @@ +From afbdce2d24b46bc91840044b953aca8b68f20fd3 Mon Sep 17 00:00:00 2001 +From: Alan Jenkins +Date: Wed, 10 Apr 2019 00:19:14 +0100 +Subject: [PATCH 1/3] DNF: fix logging, now it will work from Ansible + +The Ansible dnf module uses the python dnf bindings. In contexts like +these, stdout/stderr is owned by the host app (Ansible). dnf should not +mess with stdout/stderr, unless the host app asks it to log there. + +Specifically, it was breaking the JSON output of the Ansible module. +This was only noticeable when the etckeeper message began with a "[" +character. Ansible has a mechanism to try and skip header messages like +login banners. However, "[" is a valid character to start a JSON document. + +https://unix.stackexchange.com/questions/511210/ansible-dnf-module-module-failure/ + +This requires decoding the etckeeper messages into unicode. For gory +details, see the code comment. + +Also enable unicode string literals. This reduces differences between py2 +and py3 semantics; it is universal inside the dnf code. + +Also when I tested the failure case, I noticed the exit code was not +printed correctly. Fix it. +--- + etckeeper-dnf/etckeeper.py | 62 ++++++++++++++++++++++++++++++++------ + 1 file changed, 53 insertions(+), 9 deletions(-) + +diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py +index e8a1a51..d3376ac 100644 +--- a/etckeeper-dnf/etckeeper.py ++++ b/etckeeper-dnf/etckeeper.py +@@ -7,9 +7,11 @@ + # Distutils code below was copied from etckeeper-bzr distributed with v1.15 + # + ++from __future__ import unicode_literals + from dnfpluginscore import logger + +-import os ++import subprocess ++import locale + import dnf + + +@@ -17,20 +19,62 @@ class Etckeeper(dnf.Plugin): + + name = 'etckeeper' + +- def _out(self, msg): ++ def _debug(self, msg): + logger.debug('Etckeeper plugin: %s', msg) + ++ def _log_pipe(self, pipe): ++ # etckeeper & git messages should be encoded using the default locale ++ # (or us-ascii, which is a strict subset). ++ # ++ # Normally py2 breaks if you print arbitrary unicode when stdout is ++ # not a tty (UnicodeEncodeError). However the dnf cli has a ++ # workaround; it will survive regardless of what we do. ++ # ++ # Then we have logging.FileHandler. In py3 it will use ++ # locale.getpreferredencoding(False) by default. This should match ++ # the default locale, unless we are on py < 3.2, AND the program ++ # forgot to call setlocale(LC_ALL, ""). dnf already calls ++ # setlocale(LC_ALL, ""), so it will be nice and consistent. ++ # In fact it is the dnf *library* that calls setlocale, this is not ++ # really recommended, but it makes me pretty confident here. ++ # ++ # errors='replace' means that decode errors give us '\ufffd', which ++ # causes UnicodeEncodeError in some character encodings. Let us ++ # simulate a round-trip through errors='replace', by replacing them ++ # with a question mark. ++ # ++ # The story for py2 is more complex. In libdnf 2.6.3, the logfile ++ # is equivalent to hardcoding a utf8 encoding. That is survivable ++ # (and if it changes to match py3, it will also be fine). ++ # ++ encoding = locale.getpreferredencoding(False) ++ for line in pipe: ++ line = line.decode(encoding, 'replace') ++ line.replace('\ufffd', '?') ++ line = line.rstrip('\n') ++ logger.info('%s', line) ++ + def resolved(self): +- self._out('pre transaction commit') +- command = '%s %s' % ('etckeeper', " pre-install") +- ret = os.system(command) ++ self._debug('pre transaction commit') ++ proc = subprocess.Popen(("etckeeper", "pre-install"), ++ stdout=subprocess.PIPE, ++ stderr=subprocess.STDOUT, ++ close_fds=True) ++ self._log_pipe(proc.stdout) ++ ret = proc.wait() + if ret != 0: +- raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8)) ++ raise dnf.exceptions.Error('etckeeper returned %d' % ret) + + def transaction(self): +- self._out('post transaction commit') +- command = '%s %s > /dev/null' % ('etckeeper', "post-install") +- os.system(command) ++ self._debug('post transaction commit') ++ proc = subprocess.Popen(("etckeeper", "post-install"), ++ stdout=None, ++ stderr=subprocess.PIPE, ++ close_fds=True) ++ self._log_pipe(proc.stderr) ++ ret = proc.wait() ++ if ret != 0: ++ logger.err('etckeeper returned %d' % ret) + + if __name__ == "__main__": + from distutils.core import setup +-- +2.23.0 + + +From dcf94a71d46ff0e9981319b9a7786d565bec9a28 Mon Sep 17 00:00:00 2001 +From: Alan Jenkins +Date: Tue, 23 Apr 2019 20:15:01 +0100 +Subject: [PATCH 2/3] Do not use dnfpluginscore.logger + +dnfpluginscore is not core support for dnf plugins, it is just a +collection of "core plugins" for dnf. There is equally +dnfpluginsextras and dnfpluginsextras.logger. + +A comment in dnf.logger comment says the logger name 'dnf.plugin' is "api". +So we can safely rely on that name. + +Technically you can install etckeeper without the dnfpluginscore package +(at least I managed to run into this for python2, on a Fedora 29 system +which uses python3 for dnf by default). +--- + etckeeper-dnf/etckeeper.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py +index d3376ac..72f3dc5 100644 +--- a/etckeeper-dnf/etckeeper.py ++++ b/etckeeper-dnf/etckeeper.py +@@ -8,12 +8,14 @@ + # + + from __future__ import unicode_literals +-from dnfpluginscore import logger + ++import logging + import subprocess + import locale + import dnf + ++logger = logging.getLogger('dnf.plugin') ++ + + class Etckeeper(dnf.Plugin): + +-- +2.23.0 + + +From 6e9e369353457c2cfb303e2be15a14381e2eb53a Mon Sep 17 00:00:00 2001 +From: Thomas Moschny +Date: Tue, 19 Nov 2019 08:27:03 +0100 +Subject: [PATCH 3/3] setup() doesn't accept unicode strings. + +--- + etckeeper-dnf/etckeeper.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py +index 72f3dc5..7a9c256 100644 +--- a/etckeeper-dnf/etckeeper.py ++++ b/etckeeper-dnf/etckeeper.py +@@ -80,6 +80,6 @@ class Etckeeper(dnf.Plugin): + + if __name__ == "__main__": + from distutils.core import setup +- setup(name="dnf-etckeeper", +- packages=["dnf-plugins"], +- package_dir={"dnf-plugins":"etckeeper-dnf"}) ++ setup(name=str("dnf-etckeeper"), ++ packages=[str("dnf-plugins")], ++ package_dir={str("dnf-plugins"):str("etckeeper-dnf")}) +-- +2.23.0 + diff --git a/etckeeper.spec b/etckeeper.spec index e1a467b..652e7f2 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -33,17 +33,22 @@ Name: etckeeper Version: 1.18.10 -Release: 5%{?dist} +Release: 6%{?dist} 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 Source1: README.fedora +# build plugins separately Patch0: etckeeper-makefile-remove-python-plugins.patch +# see rhbz#1460461 Patch1: etckeeper-1.18.7-fix-rpm-ignores.patch +# see rhbz#1480843 Patch2: etckeeper-1.18.7-fix-hg-warnings.patch # From https://bugs.launchpad.net/ubuntu/+source/etckeeper/+bug/1826855 Patch3: etckeeper-add-breezy-python3-plugin.patch +# see rhbz#1762693 and https://github.com/ansible/ansible/issues/54949 +Patch4: etckeeper-1.18.10-fix-output-for-ansible.patch BuildArch: noarch BuildRequires: %{__markdown} Requires: git >= 1.6.1 @@ -127,11 +132,7 @@ etckeeper with DNF, install this package. %prep -%setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 +%autosetup -p1 %if 0%{?with_yum} # we set yum here, so the yum plugin gets built, and change that to # dnf later, if needed @@ -327,6 +328,9 @@ fi %changelog +* Tue Nov 19 2019 Thomas Moschny - 1.18.10-6 +- Add patch to fix logging with Ansible (#1762693). + * Fri Nov 01 2019 Miro Hrončok - 1.18.10-5 - Add breezy plugin on Fedora 31+ - Remove bazaar plugin on Fedora 32+ From 4c64fcc5f0b6b6811247ecf0708a6a40e75101a1 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sun, 1 Dec 2019 13:22:39 +0100 Subject: [PATCH 06/18] Update to 1.18.12. New version of patch to fix logging with Ansible (#1762693). --- ...eeper-1.18.10-fix-output-for-ansible.patch | 189 ------------------ ...eeper-1.18.12-fix-output-for-ansible.patch | 162 +++++++++++++++ etckeeper.spec | 10 +- sources | 2 +- 4 files changed, 170 insertions(+), 193 deletions(-) delete mode 100644 etckeeper-1.18.10-fix-output-for-ansible.patch create mode 100644 etckeeper-1.18.12-fix-output-for-ansible.patch diff --git a/etckeeper-1.18.10-fix-output-for-ansible.patch b/etckeeper-1.18.10-fix-output-for-ansible.patch deleted file mode 100644 index b1d0a65..0000000 --- a/etckeeper-1.18.10-fix-output-for-ansible.patch +++ /dev/null @@ -1,189 +0,0 @@ -From afbdce2d24b46bc91840044b953aca8b68f20fd3 Mon Sep 17 00:00:00 2001 -From: Alan Jenkins -Date: Wed, 10 Apr 2019 00:19:14 +0100 -Subject: [PATCH 1/3] DNF: fix logging, now it will work from Ansible - -The Ansible dnf module uses the python dnf bindings. In contexts like -these, stdout/stderr is owned by the host app (Ansible). dnf should not -mess with stdout/stderr, unless the host app asks it to log there. - -Specifically, it was breaking the JSON output of the Ansible module. -This was only noticeable when the etckeeper message began with a "[" -character. Ansible has a mechanism to try and skip header messages like -login banners. However, "[" is a valid character to start a JSON document. - -https://unix.stackexchange.com/questions/511210/ansible-dnf-module-module-failure/ - -This requires decoding the etckeeper messages into unicode. For gory -details, see the code comment. - -Also enable unicode string literals. This reduces differences between py2 -and py3 semantics; it is universal inside the dnf code. - -Also when I tested the failure case, I noticed the exit code was not -printed correctly. Fix it. ---- - etckeeper-dnf/etckeeper.py | 62 ++++++++++++++++++++++++++++++++------ - 1 file changed, 53 insertions(+), 9 deletions(-) - -diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py -index e8a1a51..d3376ac 100644 ---- a/etckeeper-dnf/etckeeper.py -+++ b/etckeeper-dnf/etckeeper.py -@@ -7,9 +7,11 @@ - # Distutils code below was copied from etckeeper-bzr distributed with v1.15 - # - -+from __future__ import unicode_literals - from dnfpluginscore import logger - --import os -+import subprocess -+import locale - import dnf - - -@@ -17,20 +19,62 @@ class Etckeeper(dnf.Plugin): - - name = 'etckeeper' - -- def _out(self, msg): -+ def _debug(self, msg): - logger.debug('Etckeeper plugin: %s', msg) - -+ def _log_pipe(self, pipe): -+ # etckeeper & git messages should be encoded using the default locale -+ # (or us-ascii, which is a strict subset). -+ # -+ # Normally py2 breaks if you print arbitrary unicode when stdout is -+ # not a tty (UnicodeEncodeError). However the dnf cli has a -+ # workaround; it will survive regardless of what we do. -+ # -+ # Then we have logging.FileHandler. In py3 it will use -+ # locale.getpreferredencoding(False) by default. This should match -+ # the default locale, unless we are on py < 3.2, AND the program -+ # forgot to call setlocale(LC_ALL, ""). dnf already calls -+ # setlocale(LC_ALL, ""), so it will be nice and consistent. -+ # In fact it is the dnf *library* that calls setlocale, this is not -+ # really recommended, but it makes me pretty confident here. -+ # -+ # errors='replace' means that decode errors give us '\ufffd', which -+ # causes UnicodeEncodeError in some character encodings. Let us -+ # simulate a round-trip through errors='replace', by replacing them -+ # with a question mark. -+ # -+ # The story for py2 is more complex. In libdnf 2.6.3, the logfile -+ # is equivalent to hardcoding a utf8 encoding. That is survivable -+ # (and if it changes to match py3, it will also be fine). -+ # -+ encoding = locale.getpreferredencoding(False) -+ for line in pipe: -+ line = line.decode(encoding, 'replace') -+ line.replace('\ufffd', '?') -+ line = line.rstrip('\n') -+ logger.info('%s', line) -+ - def resolved(self): -- self._out('pre transaction commit') -- command = '%s %s' % ('etckeeper', " pre-install") -- ret = os.system(command) -+ self._debug('pre transaction commit') -+ proc = subprocess.Popen(("etckeeper", "pre-install"), -+ stdout=subprocess.PIPE, -+ stderr=subprocess.STDOUT, -+ close_fds=True) -+ self._log_pipe(proc.stdout) -+ ret = proc.wait() - if ret != 0: -- raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8)) -+ raise dnf.exceptions.Error('etckeeper returned %d' % ret) - - def transaction(self): -- self._out('post transaction commit') -- command = '%s %s > /dev/null' % ('etckeeper', "post-install") -- os.system(command) -+ self._debug('post transaction commit') -+ proc = subprocess.Popen(("etckeeper", "post-install"), -+ stdout=None, -+ stderr=subprocess.PIPE, -+ close_fds=True) -+ self._log_pipe(proc.stderr) -+ ret = proc.wait() -+ if ret != 0: -+ logger.err('etckeeper returned %d' % ret) - - if __name__ == "__main__": - from distutils.core import setup --- -2.23.0 - - -From dcf94a71d46ff0e9981319b9a7786d565bec9a28 Mon Sep 17 00:00:00 2001 -From: Alan Jenkins -Date: Tue, 23 Apr 2019 20:15:01 +0100 -Subject: [PATCH 2/3] Do not use dnfpluginscore.logger - -dnfpluginscore is not core support for dnf plugins, it is just a -collection of "core plugins" for dnf. There is equally -dnfpluginsextras and dnfpluginsextras.logger. - -A comment in dnf.logger comment says the logger name 'dnf.plugin' is "api". -So we can safely rely on that name. - -Technically you can install etckeeper without the dnfpluginscore package -(at least I managed to run into this for python2, on a Fedora 29 system -which uses python3 for dnf by default). ---- - etckeeper-dnf/etckeeper.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py -index d3376ac..72f3dc5 100644 ---- a/etckeeper-dnf/etckeeper.py -+++ b/etckeeper-dnf/etckeeper.py -@@ -8,12 +8,14 @@ - # - - from __future__ import unicode_literals --from dnfpluginscore import logger - -+import logging - import subprocess - import locale - import dnf - -+logger = logging.getLogger('dnf.plugin') -+ - - class Etckeeper(dnf.Plugin): - --- -2.23.0 - - -From 6e9e369353457c2cfb303e2be15a14381e2eb53a Mon Sep 17 00:00:00 2001 -From: Thomas Moschny -Date: Tue, 19 Nov 2019 08:27:03 +0100 -Subject: [PATCH 3/3] setup() doesn't accept unicode strings. - ---- - etckeeper-dnf/etckeeper.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py -index 72f3dc5..7a9c256 100644 ---- a/etckeeper-dnf/etckeeper.py -+++ b/etckeeper-dnf/etckeeper.py -@@ -80,6 +80,6 @@ class Etckeeper(dnf.Plugin): - - if __name__ == "__main__": - from distutils.core import setup -- setup(name="dnf-etckeeper", -- packages=["dnf-plugins"], -- package_dir={"dnf-plugins":"etckeeper-dnf"}) -+ setup(name=str("dnf-etckeeper"), -+ packages=[str("dnf-plugins")], -+ package_dir={str("dnf-plugins"):str("etckeeper-dnf")}) --- -2.23.0 - diff --git a/etckeeper-1.18.12-fix-output-for-ansible.patch b/etckeeper-1.18.12-fix-output-for-ansible.patch new file mode 100644 index 0000000..7ca4b4f --- /dev/null +++ b/etckeeper-1.18.12-fix-output-for-ansible.patch @@ -0,0 +1,162 @@ +From 8266a4fb45621e08085c58537a531f33fc7eca74 Mon Sep 17 00:00:00 2001 +From: Alan Jenkins +Date: Wed, 10 Apr 2019 00:19:14 +0100 +Subject: [PATCH 1/2] DNF: stderr is not ours to log to (and doing so breaks + Ansible) + +stderr does not belong to etckeeper-dnf +--------------------------------------- + +The Ansible dnf module uses the python dnf bindings. In contexts like +these, stdout/stderr is owned by the host app (Ansible). dnf should not +mess with stdout/stderr, unless the host app asks it to log there. + +Specifically, we were breaking the JSON output of the Ansible dnf module. +This was only noticeable when the etckeeper message began with a "[" +character. Ansible has a mechanism to try and skip header messages like +login banners. However, "[" is a valid character to start a JSON document. + +https://unix.stackexchange.com/questions/511210/ansible-dnf-module-module-failure/ + +Solution +-------- + +Instead, log any non-zero exit status through the dnf logger. + +For the pre-transaction etckeeper run, this message replaces an exception. +So we now avoid logging a traceback, which did not appear to add anything +useful. (In my testing, dnf was continued to install after the exception +was logged). + +I have also added a warning message for the post-transaction etckeeper run. + +I switched from os.system() to subprocess.call(). The latter interface +supports better error reporting. (When I tested os.system(), it returned +an errno number which was indistinguishable from an exit code). + +etckeeper >/dev/null 2>&1 +-------------------------- + +Any specific error messages from etckeeper are now discarded. Because +unfortunately, python conventions about passing text strings have been +somewhat unclear. It is an error to log strings if the encoding settings +of a registered logger cannot handle them. Because a "bad" character +causes the entire string to be discarded, and optionally an exception +printed to stderr. In a previous proposal I showed code that should be +correct in all expected cases. However, the length of comment required to +define "all expected cases" was not very reassuring. + +That was on top of explaining that dnf has a workaround that will avoid +raising exceptions when arbitrary unicode is logged to stdout. My proposal +had to include that explanation, to show that we were not breaking a +system package manager. + +It might sound strange to talk about error messages with characters +we cannot encode. But I have one word for you: "filenames". + +(After the recent python PR #14008[1], logging.basicConfig() defaults +to errors='backslashreplace'. Also, errors= can be manually specified when +creating a lower-level logging "Handler". I think this will resolve the +problem in the future. It means that when programs are written for this +new version of python, it should be the responsibility of the log setup +code to prevent UnicodeEncodeError.) + +[1] https://github.com/python/cpython/pull/14008 +--- + etckeeper-dnf/etckeeper.py | 27 ++++++++++++++++----------- + 1 file changed, 16 insertions(+), 11 deletions(-) + +diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py +index e8a1a51..69edd88 100644 +--- a/etckeeper-dnf/etckeeper.py ++++ b/etckeeper-dnf/etckeeper.py +@@ -9,7 +9,7 @@ + + from dnfpluginscore import logger + +-import os ++import subprocess + import dnf + + +@@ -17,20 +17,25 @@ class Etckeeper(dnf.Plugin): + + name = 'etckeeper' + +- def _out(self, msg): +- logger.debug('Etckeeper plugin: %s', msg) ++ def _run_command(self, command): ++ logger.debug('Etckeeper plugin: %s', command) ++ try: ++ with open("/dev/null", "wb") as devnull: ++ ret = subprocess.call(("etckeeper", command), ++ stdout=devnull, stderr=devnull, ++ close_fds=True) ++ if ret > 0: ++ logger.warning('"etckeeper %s" failed (exit code %d)' % (command, ret)) ++ if ret < 0: ++ logger.warning('"etckeeper %s" died (signal %d)' % (command, -ret)) ++ except OSError as err: ++ logger.warning('Failed to run "etckeeper %s": %s' % (command, err)) + + def resolved(self): +- self._out('pre transaction commit') +- command = '%s %s' % ('etckeeper', " pre-install") +- ret = os.system(command) +- if ret != 0: +- raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8)) ++ self._run_command("pre-install") + + def transaction(self): +- self._out('post transaction commit') +- command = '%s %s > /dev/null' % ('etckeeper', "post-install") +- os.system(command) ++ self._run_command("post-install") + + if __name__ == "__main__": + from distutils.core import setup +-- +2.23.0 + + +From 7cda9678b1e60c0495a2a522721b319843d5fae0 Mon Sep 17 00:00:00 2001 +From: Alan Jenkins +Date: Tue, 23 Apr 2019 20:15:01 +0100 +Subject: [PATCH 2/2] Do not use dnfpluginscore.logger + +dnfpluginscore is not core support for dnf plugins, it is just a +collection of "core plugins" for dnf. There is equally +dnfpluginsextras and dnfpluginsextras.logger. + +A comment in dnf.logger comment says the logger name 'dnf.plugin' is "api". +So we can safely rely on that name. + +Technically you can install etckeeper without the dnfpluginscore package +(at least I managed to run into this for python2, on a Fedora 29 system +which uses python3 for dnf by default). +--- + etckeeper-dnf/etckeeper.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py +index 69edd88..d9dd2c3 100644 +--- a/etckeeper-dnf/etckeeper.py ++++ b/etckeeper-dnf/etckeeper.py +@@ -7,11 +7,12 @@ + # Distutils code below was copied from etckeeper-bzr distributed with v1.15 + # + +-from dnfpluginscore import logger +- ++import logging + import subprocess + import dnf + ++logger = logging.getLogger('dnf.plugin') ++ + + class Etckeeper(dnf.Plugin): + +-- +2.23.0 + diff --git a/etckeeper.spec b/etckeeper.spec index 652e7f2..f73ccd4 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -32,8 +32,8 @@ %endif Name: etckeeper -Version: 1.18.10 -Release: 6%{?dist} +Version: 1.18.12 +Release: 1%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ @@ -48,7 +48,7 @@ Patch2: etckeeper-1.18.7-fix-hg-warnings.patch # From https://bugs.launchpad.net/ubuntu/+source/etckeeper/+bug/1826855 Patch3: etckeeper-add-breezy-python3-plugin.patch # see rhbz#1762693 and https://github.com/ansible/ansible/issues/54949 -Patch4: etckeeper-1.18.10-fix-output-for-ansible.patch +Patch4: etckeeper-1.18.12-fix-output-for-ansible.patch BuildArch: noarch BuildRequires: %{__markdown} Requires: git >= 1.6.1 @@ -328,6 +328,10 @@ fi %changelog +* Sun Dec 1 2019 Thomas Moschny - 1.18.12-1 +- Update to 1.18.12. +- New version of patch to fix logging with Ansible (#1762693). + * Tue Nov 19 2019 Thomas Moschny - 1.18.10-6 - Add patch to fix logging with Ansible (#1762693). diff --git a/sources b/sources index 033b121..67c6744 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.10.tar.gz) = 57eb91823c37f364e7ade6b25d2ab91fc99d1192a606fd09370c2876a0440120a625f30167fc52fb16b53ef9f7a58a1329bfe9567cbc2c91da06a345ebbe8e05 +SHA512 (etckeeper-1.18.12.tar.gz) = 7fb75d89bbf69d5ef29fc93f34f8368f0d93adb6f89a96be4769be4a58faff793682f5a5fc6f6f2bf51bc5a151a28b61319396a4298cbf0aa75ff3c1bbb660d7 From c5b58d564de0c1cd0c726281a01312a3f5798c05 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 14 Mar 2020 10:01:09 +0100 Subject: [PATCH 07/18] Update to 1.18.14. Include zsh completion. Mark cron file as config file. --- etckeeper.spec | 12 ++++++++++-- sources | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/etckeeper.spec b/etckeeper.spec index f73ccd4..9a5351b 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -32,7 +32,7 @@ %endif Name: etckeeper -Version: 1.18.12 +Version: 1.18.14 Release: 1%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ @@ -271,7 +271,7 @@ fi %{_sysconfdir}/%{name}/*.d %{_sysconfdir}/%{name}/daily %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf -%{_sysconfdir}/cron.daily/%{name} +%config(noreplace) %{_sysconfdir}/cron.daily/%{name} %if 0%{?fedora} || 0%{?rhel} >= 7 %dir %{_datadir}/bash-completion %dir %{_datadir}/bash-completion/completions @@ -280,6 +280,9 @@ fi %dir %{_sysconfdir}/bash_completion.d %{_sysconfdir}/bash_completion.d/%{name} %endif +%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}.* @@ -328,6 +331,11 @@ fi %changelog +* Sat Mar 14 2020 Thomas Moschny - 1.18.14-1 +- Update to 1.18.14. +- Include zsh completion. +- Mark cron file as config file. + * Sun Dec 1 2019 Thomas Moschny - 1.18.12-1 - Update to 1.18.12. - New version of patch to fix logging with Ansible (#1762693). diff --git a/sources b/sources index 67c6744..3db483a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.12.tar.gz) = 7fb75d89bbf69d5ef29fc93f34f8368f0d93adb6f89a96be4769be4a58faff793682f5a5fc6f6f2bf51bc5a151a28b61319396a4298cbf0aa75ff3c1bbb660d7 +SHA512 (etckeeper-1.18.14.tar.gz) = 1bc01845d47ce3af1ef56474745843e8be6e005da90a21bed302fe73476fbf1f64b84fae7dac73139c394ca698bd146e1609fa34ebbc6737ba73a6f61e670948 From cc1985118b5c637ee083b32207d03d3293bbb3da Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Thu, 24 Sep 2020 17:12:58 +0000 Subject: [PATCH 08/18] remove package.cfg per new epel-playground policy --- package.cfg | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 package.cfg diff --git a/package.cfg b/package.cfg deleted file mode 100644 index 66ea79d..0000000 --- a/package.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[koji] -targets = epel8 epel8-playground \ No newline at end of file From ec9a74382fef618b254a0959df99dba45416b7c4 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Tue, 9 Feb 2021 20:59:56 +0100 Subject: [PATCH 09/18] Update to 1.18.16. Update spec file, remove obsolete conditionals. --- cron.daily | 8 ++++ etckeeper.spec | 110 +++++++++++++++---------------------------------- sources | 2 +- 3 files changed, 42 insertions(+), 78 deletions(-) create mode 100644 cron.daily diff --git a/cron.daily b/cron.daily new file mode 100644 index 0000000..eb74401 --- /dev/null +++ b/cron.daily @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +if [ -e /etc/etckeeper/daily ] && [ -e /etc/etckeeper/etckeeper.conf ]; then + . /etc/etckeeper/etckeeper.conf + if [ "$AVOID_DAILY_AUTOCOMMITS" != "1" ]; then + /etc/etckeeper/daily + fi +fi diff --git a/etckeeper.spec b/etckeeper.spec index 9a5351b..17d8708 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -1,29 +1,14 @@ %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} -%if (0%{?fedora} && 0%{?fedora} < 32) || (0%{?rhel} && 0%{?rhel} <= 7) +%if 0%{?rhel} && 0%{?rhel} <= 7 +%global with_yum 1 %global with_bzr 1 -%endif - -%if 0%{?fedora} >= 31 -%global with_brz 1 -# this is used to mention the correct package in descriptions -%global bazaar brz -%else %global bazaar bzr %endif -%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 with_systemd 1 -%global __markdown %{_bindir}/markdown_py -%global hostname_dep hostname -%else -%global __markdown %{_bindir}/markdown -%global hostname_dep net-tools +%if 0%{?fedora} +%global with_brz 1 +%global bazaar brz %endif %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -32,13 +17,14 @@ %endif Name: etckeeper -Version: 1.18.14 +Version: 1.18.16 Release: 1%{?dist} 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 Source1: README.fedora +Source2: cron.daily # build plugins separately Patch0: etckeeper-makefile-remove-python-plugins.patch # see rhbz#1460461 @@ -50,22 +36,20 @@ Patch3: etckeeper-add-breezy-python3-plugin.patch # see rhbz#1762693 and https://github.com/ansible/ansible/issues/54949 Patch4: etckeeper-1.18.12-fix-output-for-ansible.patch BuildArch: noarch -BuildRequires: %{__markdown} +BuildRequires: %{_bindir}/markdown_py Requires: git >= 1.6.1 Requires: perl-interpreter Requires: crontabs Requires: findutils -Requires: %{hostname_dep} +Requires: hostname Requires: which %if 0%{?dnf_is_mandatory} Requires: %{name}-dnf = %{version}-%{release} %endif # dnf_is_mandatory -%if 0%{?with_systemd} BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -%endif # with_systemd %description The etckeeper program is a tool to let /etc be stored in a git, @@ -78,7 +62,7 @@ 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). -To use bzr as backend, please also install the %{name}-%{bazaar} package. +%{?bazaar: To use bazaar/breezy as backend, please also install the %{name}-%{bazaar} package.} To start using the package please read %{_pkgdocdir}/README. @@ -111,7 +95,6 @@ etckeeper with (bzr) bazaar repositories, install this package. %endif # with_brz -%if 0%{?with_dnf} %package dnf Summary: DNF plugin for etckeeper support %if 0%{?dnf_uses_python3} @@ -128,7 +111,6 @@ Requires: dnf-plugins-core %description dnf This package provides a DNF plugin for etckeeper. If you want to use etckeeper with DNF, install this package. -%endif # with_dnf %prep @@ -149,11 +131,8 @@ sed -e 's|^prefix=.*|prefix=%{_prefix}|' \ -e 's|^vardir=.*|vardir=%{_localstatedir}|' \ -e 's|^INSTALL=.*|INSTALL=install -p|' \ -e 's|^CP=.*|CP=cp -pR|' \ + -e 's|^systemddir=.*|systemddir=%{_unitdir}|' \ -i Makefile -%if 0%{?with_systemd} -sed -e 's|^systemddir=.*|systemddir=%{_unitdir}|' \ - -i Makefile -%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 @@ -163,54 +142,57 @@ cp -av %{SOURCE1} . %build -make %{?_smp_mflags} +%make_build %if 0%{?with_bzr} pushd bzr-plugin -%{__python2} etckeeper-bzr/__init__.py build +%define py_setup etckeeper-bzr/__init__.py +%py2_build popd %endif # with_bzr %if 0%{?with_brz} pushd brz-plugin -%{__python3} etckeeper-brz/__init__.py build +%define py_setup etckeeper-brz/__init__.py +%py3_build popd %endif # with_brz -%if 0%{?with_dnf} pushd dnf-plugin +%define py_setup etckeeper-dnf/etckeeper.py build %if 0%{?dnf_uses_python3} -%{__python3} etckeeper-dnf/etckeeper.py build --executable="%{__python3} -s" +%py3_build %else -%{__python2} etckeeper-dnf/etckeeper.py build --executable="%{__python2} -s" +%py2_build %endif # dnf_uses_python3 popd -%endif # with_dnf -%{__markdown} -f README.html README.md +markdown_py -f README.html README.md %install -make install DESTDIR=%{buildroot} +%make_install %if 0%{?with_bzr} pushd bzr-plugin -%{__python2} etckeeper-bzr/__init__.py install -O1 --skip-build --root %{buildroot} +%define py_setup etckeeper-bzr/__init__.py +%py2_install popd %endif # with_bzr %if 0%{?with_brz} pushd brz-plugin -%{__python3} etckeeper-brz/__init__.py install -O1 --skip-build --root %{buildroot} +%define py_setup etckeeper-brz/__init__.py +%py3_install popd %endif # with_brz -%if 0%{?with_dnf} pushd dnf-plugin +%define py_setup etckeeper-dnf/etckeeper.py build %if 0%{?dnf_uses_python3} -%{__python3} etckeeper-dnf/etckeeper.py install -O1 --skip-build --root %{buildroot} +%py3_install %else -%{__python2} etckeeper-dnf/etckeeper.py install -O1 --skip-build --root %{buildroot} +%py2_install %endif # dnf_uses_python3 popd @@ -218,48 +200,27 @@ popd sed -e 's|HIGHLEVEL_PACKAGE_MANAGER=.*|HIGHLEVEL_PACKAGE_MANAGER=dnf|' \ -i %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf %endif # dnf_is_mandatory -%endif # with_dnf -install -D -p debian/cron.daily %{buildroot}%{_sysconfdir}/cron.daily/%{name} +install -D -p %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.daily/%{name} install -d %{buildroot}%{_localstatedir}/cache/%{name} -# on RHEL < 7, move the completion file back to /etc/bash_completion.d -%if !(0%{?fedora} || 0%{?rhel} >= 7) -install -d %{buildroot}%{_sysconfdir}/bash_completion.d -mv %{buildroot}%{_datadir}/bash-completion/completions/%{name} \ - %{buildroot}%{_sysconfdir}/bash_completion.d/%{name} -%endif - -# remove unit files if not used (note: /lib/systemd/system is the -# original, hardcoded location from the etckeeper Makefile) -%if !0%{?with_systemd} -rm %{buildroot}/lib/systemd/system/%{name}.service -rm %{buildroot}/lib/systemd/system/%{name}.timer -%endif - %post if [ $1 -gt 1 ] ; then %{_bindir}/%{name} update-ignore fi -%if 0%{?with_systemd} %systemd_post %{name}.service %systemd_post %{name}.timer -%endif # with_systemd %preun -%if 0%{?with_systemd} %systemd_preun %{name}.service %systemd_preun %{name}.timer -%endif # with_systemd %postun -%if 0%{?with_systemd} %systemd_postun %{name}.service %systemd_postun %{name}.timer -%endif # with_systemd %files @@ -272,14 +233,9 @@ fi %{_sysconfdir}/%{name}/daily %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %{_sysconfdir}/cron.daily/%{name} -%if 0%{?fedora} || 0%{?rhel} >= 7 %dir %{_datadir}/bash-completion %dir %{_datadir}/bash-completion/completions %{_datadir}/bash-completion/completions/%{name} -%else -%dir %{_sysconfdir}/bash_completion.d -%{_sysconfdir}/bash_completion.d/%{name} -%endif %dir %{_datadir}/zsh %dir %{_datadir}/zsh/vendor-completions %{_datadir}/zsh/vendor-completions/_%{name} @@ -290,10 +246,8 @@ fi %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/%{name}.conf %endif # with_yum %{_localstatedir}/cache/%{name} -%if 0%{?with_systemd} %{_unitdir}/%{name}.service %{_unitdir}/%{name}.timer -%endif # with_systemd %if 0%{?with_bzr} @@ -314,7 +268,6 @@ fi %endif # with_brz -%if 0%{?with_dnf} %files dnf %if 0%{?dnf_uses_python3} %{python3_sitelib}/dnf-plugins/%{name}.py @@ -327,10 +280,13 @@ fi %exclude %{python2_sitelib}/dnf-plugins/__init__.py* %{python2_sitelib}/dnf_%{name}-*.egg-info %endif # dnf_uses_python3 -%endif # with_dnf %changelog +* Tue Feb 9 2021 Thomas Moschny - 1.18.16-1 +- Update to 1.18.16. +- Update spec file, remove obsolete conditionals. + * Sat Mar 14 2020 Thomas Moschny - 1.18.14-1 - Update to 1.18.14. - Include zsh completion. diff --git a/sources b/sources index 3db483a..def5238 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.14.tar.gz) = 1bc01845d47ce3af1ef56474745843e8be6e005da90a21bed302fe73476fbf1f64b84fae7dac73139c394ca698bd146e1609fa34ebbc6737ba73a6f61e670948 +SHA512 (etckeeper-1.18.16.tar.gz) = 48a9f0089f72d62d68467b17a5a441dbf219c6b5b817b8ef2160b5f50eef6492257393c482a658ce11a97983ed037caa80b92e289049987bde5f8fbb22c98f07 From 23c7d7b6e5200079a0a1fcdf0f17ee221d398703 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 4 Jan 2021 22:15:48 +0000 Subject: [PATCH 10/18] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- etckeeper.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/etckeeper.spec b/etckeeper.spec index 17d8708..c2f44f0 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -104,6 +104,7 @@ BuildRequires: python2-devel %endif # dnf_uses_python3 BuildRequires: dnf BuildRequires: dnf-plugins-core +BuildRequires: make Requires: %{name} = %{version}-%{release} Requires: dnf Requires: dnf-plugins-core From 3413ffada97c6a586619af2a39c882a962fb00b4 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Mon, 31 Jan 2022 21:28:26 +0100 Subject: [PATCH 11/18] Exclude egg-info directories for dnf, bzr and brz plugins (#2048085). --- etckeeper.spec | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/etckeeper.spec b/etckeeper.spec index c2f44f0..09efeeb 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -18,7 +18,7 @@ Name: etckeeper Version: 1.18.16 -Release: 1%{?dist} +Release: 5%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ @@ -254,7 +254,8 @@ fi %if 0%{?with_bzr} %files bzr %{python2_sitelib}/bzrlib/plugins/%{name} -%{python2_sitelib}/bzr_%{name}-*.egg-info +# exclude egg-info dir, doesn't contain meaningful information +%exclude %{python2_sitelib}/bzr_%{name}-*.egg-info %endif # with_bzr @@ -265,7 +266,8 @@ fi %dir %{python3_sitelib}/breezy/ %dir %{python3_sitelib}/breezy/plugins/ %{python3_sitelib}/breezy/plugins/%{name}/ -%{python3_sitelib}/brz_%{name}-*.egg-info +# exclude egg-info dir, doesn't contain meaningful information +%exclude %{python3_sitelib}/brz_%{name}-*.egg-info %endif # with_brz @@ -275,15 +277,20 @@ fi %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 +# exclude egg-info dir, doesn't contain meaningful information +%exclude %{python3_sitelib}/dnf_%{name}-*.egg-info %else %{python2_sitelib}/dnf-plugins/%{name}.py* %exclude %{python2_sitelib}/dnf-plugins/__init__.py* -%{python2_sitelib}/dnf_%{name}-*.egg-info +# exclude egg-info dir, doesn't contain meaningful information +%exclude %{python2_sitelib}/dnf_%{name}-*.egg-info %endif # dnf_uses_python3 %changelog +* Mon Jan 31 2022 Thomas Moschny - 1.18.16-5 +- Exclude egg-info directories for dnf, bzr and brz plugins (#2048085). + * Tue Feb 9 2021 Thomas Moschny - 1.18.16-1 - Update to 1.18.16. - Update spec file, remove obsolete conditionals. From 7e8650ff966149dbd48ffd582eb2558277453f11 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Wed, 16 Feb 2022 09:11:42 -0500 Subject: [PATCH 12/18] require git-core instead of git Avoid pulling in more dependencies that necessary. The functionality required is in git-core. --- etckeeper.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etckeeper.spec b/etckeeper.spec index 09efeeb..9dd74e1 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -18,7 +18,7 @@ Name: etckeeper Version: 1.18.16 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ @@ -37,7 +37,7 @@ Patch3: etckeeper-add-breezy-python3-plugin.patch Patch4: etckeeper-1.18.12-fix-output-for-ansible.patch BuildArch: noarch BuildRequires: %{_bindir}/markdown_py -Requires: git >= 1.6.1 +Requires: git-core Requires: perl-interpreter Requires: crontabs Requires: findutils @@ -288,6 +288,9 @@ fi %changelog +* Wed Feb 16 2022 Todd Zullinger - 1.18.16-6 +- Require git-core instead of git + * Mon Jan 31 2022 Thomas Moschny - 1.18.16-5 - Exclude egg-info directories for dnf, bzr and brz plugins (#2048085). From a155b18fd20cd3e7aad7752d9ede8f77c9907638 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Tue, 8 Mar 2022 22:41:15 +0100 Subject: [PATCH 13/18] Update to 1.18.17. --- etckeeper.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/etckeeper.spec b/etckeeper.spec index 9dd74e1..ecda816 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -17,8 +17,8 @@ %endif Name: etckeeper -Version: 1.18.16 -Release: 6%{?dist} +Version: 1.18.17 +Release: 1%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ URL: https://etckeeper.branchable.com/ @@ -288,6 +288,9 @@ fi %changelog +* Tue Mar 8 2022 Thomas Moschny - 1.18.17-1 +- Update to 1.18.17. + * Wed Feb 16 2022 Todd Zullinger - 1.18.16-6 - Require git-core instead of git diff --git a/sources b/sources index def5238..73fac7e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.16.tar.gz) = 48a9f0089f72d62d68467b17a5a441dbf219c6b5b817b8ef2160b5f50eef6492257393c482a658ce11a97983ed037caa80b92e289049987bde5f8fbb22c98f07 +SHA512 (etckeeper-1.18.17.tar.gz) = 6e75d0f38c8d27ba290ab6e1a51d50ca7a736c958da7a1edb792a5c7f1eedd4848adbb43571425f127bf2c5fe39d5b7887968b09178ca5385ec0abeaeb6cfa00 From fb5a96460b70316ff9e717a60e0249241aa904df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 21 Oct 2022 12:01:10 +0200 Subject: [PATCH 14/18] BuilRequire setuptools when Python >= 3.12 The dnf and brz setups use distutils. Python 3.12 removes distutils, but setuptools can provide it instead. --- etckeeper.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etckeeper.spec b/etckeeper.spec index ecda816..47bdac4 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -85,6 +85,7 @@ etckeeper with bzr backend, install this package. %package brz Summary: Support for bzr with etckeeper (via breezy) BuildRequires: python3-devel +BuildRequires: (python3-setuptools if python3-devel >= 3.12) BuildRequires: brz Requires: %{name} = %{version}-%{release} Requires: brz @@ -99,6 +100,7 @@ etckeeper with (bzr) bazaar repositories, install this package. Summary: DNF plugin for etckeeper support %if 0%{?dnf_uses_python3} BuildRequires: python3-devel +BuildRequires: (python3-setuptools if python3-devel >= 3.12) %else BuildRequires: python2-devel %endif # dnf_uses_python3 From fd12d9890183c7f9c7a4c99e25c6c066a114ed54 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 3 Dec 2022 12:11:17 +0100 Subject: [PATCH 15/18] Update to 1.18.18. Rebase patches. Update patch to fix logging with Ansible (#1917461). BuilRequire setuptools when Python >= 3.12. --- ...eeper-1.18.12-fix-output-for-ansible.patch | 162 ------------------ ...=> etckeeper-1.18.18-fix-hg-warnings.patch | 4 +- ...eeper-1.18.18-fix-output-for-ansible.patch | 52 ++++++ etckeeper.spec | 13 +- sources | 2 +- 5 files changed, 65 insertions(+), 168 deletions(-) delete mode 100644 etckeeper-1.18.12-fix-output-for-ansible.patch rename etckeeper-1.18.7-fix-hg-warnings.patch => etckeeper-1.18.18-fix-hg-warnings.patch (95%) create mode 100644 etckeeper-1.18.18-fix-output-for-ansible.patch diff --git a/etckeeper-1.18.12-fix-output-for-ansible.patch b/etckeeper-1.18.12-fix-output-for-ansible.patch deleted file mode 100644 index 7ca4b4f..0000000 --- a/etckeeper-1.18.12-fix-output-for-ansible.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 8266a4fb45621e08085c58537a531f33fc7eca74 Mon Sep 17 00:00:00 2001 -From: Alan Jenkins -Date: Wed, 10 Apr 2019 00:19:14 +0100 -Subject: [PATCH 1/2] DNF: stderr is not ours to log to (and doing so breaks - Ansible) - -stderr does not belong to etckeeper-dnf ---------------------------------------- - -The Ansible dnf module uses the python dnf bindings. In contexts like -these, stdout/stderr is owned by the host app (Ansible). dnf should not -mess with stdout/stderr, unless the host app asks it to log there. - -Specifically, we were breaking the JSON output of the Ansible dnf module. -This was only noticeable when the etckeeper message began with a "[" -character. Ansible has a mechanism to try and skip header messages like -login banners. However, "[" is a valid character to start a JSON document. - -https://unix.stackexchange.com/questions/511210/ansible-dnf-module-module-failure/ - -Solution --------- - -Instead, log any non-zero exit status through the dnf logger. - -For the pre-transaction etckeeper run, this message replaces an exception. -So we now avoid logging a traceback, which did not appear to add anything -useful. (In my testing, dnf was continued to install after the exception -was logged). - -I have also added a warning message for the post-transaction etckeeper run. - -I switched from os.system() to subprocess.call(). The latter interface -supports better error reporting. (When I tested os.system(), it returned -an errno number which was indistinguishable from an exit code). - -etckeeper >/dev/null 2>&1 --------------------------- - -Any specific error messages from etckeeper are now discarded. Because -unfortunately, python conventions about passing text strings have been -somewhat unclear. It is an error to log strings if the encoding settings -of a registered logger cannot handle them. Because a "bad" character -causes the entire string to be discarded, and optionally an exception -printed to stderr. In a previous proposal I showed code that should be -correct in all expected cases. However, the length of comment required to -define "all expected cases" was not very reassuring. - -That was on top of explaining that dnf has a workaround that will avoid -raising exceptions when arbitrary unicode is logged to stdout. My proposal -had to include that explanation, to show that we were not breaking a -system package manager. - -It might sound strange to talk about error messages with characters -we cannot encode. But I have one word for you: "filenames". - -(After the recent python PR #14008[1], logging.basicConfig() defaults -to errors='backslashreplace'. Also, errors= can be manually specified when -creating a lower-level logging "Handler". I think this will resolve the -problem in the future. It means that when programs are written for this -new version of python, it should be the responsibility of the log setup -code to prevent UnicodeEncodeError.) - -[1] https://github.com/python/cpython/pull/14008 ---- - etckeeper-dnf/etckeeper.py | 27 ++++++++++++++++----------- - 1 file changed, 16 insertions(+), 11 deletions(-) - -diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py -index e8a1a51..69edd88 100644 ---- a/etckeeper-dnf/etckeeper.py -+++ b/etckeeper-dnf/etckeeper.py -@@ -9,7 +9,7 @@ - - from dnfpluginscore import logger - --import os -+import subprocess - import dnf - - -@@ -17,20 +17,25 @@ class Etckeeper(dnf.Plugin): - - name = 'etckeeper' - -- def _out(self, msg): -- logger.debug('Etckeeper plugin: %s', msg) -+ def _run_command(self, command): -+ logger.debug('Etckeeper plugin: %s', command) -+ try: -+ with open("/dev/null", "wb") as devnull: -+ ret = subprocess.call(("etckeeper", command), -+ stdout=devnull, stderr=devnull, -+ close_fds=True) -+ if ret > 0: -+ logger.warning('"etckeeper %s" failed (exit code %d)' % (command, ret)) -+ if ret < 0: -+ logger.warning('"etckeeper %s" died (signal %d)' % (command, -ret)) -+ except OSError as err: -+ logger.warning('Failed to run "etckeeper %s": %s' % (command, err)) - - def resolved(self): -- self._out('pre transaction commit') -- command = '%s %s' % ('etckeeper', " pre-install") -- ret = os.system(command) -- if ret != 0: -- raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8)) -+ self._run_command("pre-install") - - def transaction(self): -- self._out('post transaction commit') -- command = '%s %s > /dev/null' % ('etckeeper', "post-install") -- os.system(command) -+ self._run_command("post-install") - - if __name__ == "__main__": - from distutils.core import setup --- -2.23.0 - - -From 7cda9678b1e60c0495a2a522721b319843d5fae0 Mon Sep 17 00:00:00 2001 -From: Alan Jenkins -Date: Tue, 23 Apr 2019 20:15:01 +0100 -Subject: [PATCH 2/2] Do not use dnfpluginscore.logger - -dnfpluginscore is not core support for dnf plugins, it is just a -collection of "core plugins" for dnf. There is equally -dnfpluginsextras and dnfpluginsextras.logger. - -A comment in dnf.logger comment says the logger name 'dnf.plugin' is "api". -So we can safely rely on that name. - -Technically you can install etckeeper without the dnfpluginscore package -(at least I managed to run into this for python2, on a Fedora 29 system -which uses python3 for dnf by default). ---- - etckeeper-dnf/etckeeper.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py -index 69edd88..d9dd2c3 100644 ---- a/etckeeper-dnf/etckeeper.py -+++ b/etckeeper-dnf/etckeeper.py -@@ -7,11 +7,12 @@ - # Distutils code below was copied from etckeeper-bzr distributed with v1.15 - # - --from dnfpluginscore import logger -- -+import logging - import subprocess - import dnf - -+logger = logging.getLogger('dnf.plugin') -+ - - class Etckeeper(dnf.Plugin): - --- -2.23.0 - diff --git a/etckeeper-1.18.7-fix-hg-warnings.patch b/etckeeper-1.18.18-fix-hg-warnings.patch similarity index 95% rename from etckeeper-1.18.7-fix-hg-warnings.patch rename to etckeeper-1.18.18-fix-hg-warnings.patch index 90c6818..7a74e70 100644 --- a/etckeeper-1.18.7-fix-hg-warnings.patch +++ b/etckeeper-1.18.18-fix-hg-warnings.patch @@ -1,5 +1,5 @@ diff --git a/pre-commit.d/20warn-problem-files b/pre-commit.d/20warn-problem-files -index 6bd5c2b..7899268 100755 +index 43320e4..7899268 100755 --- a/pre-commit.d/20warn-problem-files +++ b/pre-commit.d/20warn-problem-files @@ -1,19 +1,20 @@ @@ -7,7 +7,7 @@ index 6bd5c2b..7899268 100755 set -e -exclude_internal () { -- egrep -v '(^|/)(\.git|\.hg|\.bzr|_darcs)/' +- grep -E -v '(^|/)(\.git|\.hg|\.bzr|_darcs)/' -} +# (Note that when using this, the find expression must end with +# -print or -exec, else the excluded directories will actually be diff --git a/etckeeper-1.18.18-fix-output-for-ansible.patch b/etckeeper-1.18.18-fix-output-for-ansible.patch new file mode 100644 index 0000000..b36af3c --- /dev/null +++ b/etckeeper-1.18.18-fix-output-for-ansible.patch @@ -0,0 +1,52 @@ +diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py +index e8a1a51..7c3210b 100644 +--- a/etckeeper-dnf/etckeeper.py ++++ b/etckeeper-dnf/etckeeper.py +@@ -7,30 +7,34 @@ + # Distutils code below was copied from etckeeper-bzr distributed with v1.15 + # + +-from dnfpluginscore import logger +- +-import os ++import logging ++import subprocess + import dnf + ++logger = logging.getLogger('dnf.plugin') ++ + + class Etckeeper(dnf.Plugin): + + name = 'etckeeper' + +- def _out(self, msg): +- logger.debug('Etckeeper plugin: %s', msg) ++ def _run_command(self, command): ++ logger.debug('Etckeeper plugin: %s', command) ++ try: ++ with open("/dev/null", "wb") as devnull: ++ ret = subprocess.call(("etckeeper", command), ++ stdout=devnull, stderr=devnull, ++ close_fds=True) ++ if ret != 0: ++ raise dnf.exceptions.Error('"etckeeper %s" returned: %d' % (command, ret)) ++ except OSError as err: ++ logger.warning('Failed to run "etckeeper %s": %s' % (command, err)) + + def resolved(self): +- self._out('pre transaction commit') +- command = '%s %s' % ('etckeeper', " pre-install") +- ret = os.system(command) +- if ret != 0: +- raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8)) ++ self._run_command("pre-install") + + def transaction(self): +- self._out('post transaction commit') +- command = '%s %s > /dev/null' % ('etckeeper', "post-install") +- os.system(command) ++ self._run_command("post-install") + + if __name__ == "__main__": + from distutils.core import setup diff --git a/etckeeper.spec b/etckeeper.spec index 47bdac4..6d566be 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -17,7 +17,7 @@ %endif Name: etckeeper -Version: 1.18.17 +Version: 1.18.18 Release: 1%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ @@ -30,11 +30,12 @@ Patch0: etckeeper-makefile-remove-python-plugins.patch # see rhbz#1460461 Patch1: etckeeper-1.18.7-fix-rpm-ignores.patch # see rhbz#1480843 -Patch2: etckeeper-1.18.7-fix-hg-warnings.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 # see rhbz#1762693 and https://github.com/ansible/ansible/issues/54949 -Patch4: etckeeper-1.18.12-fix-output-for-ansible.patch +# see also rhbz#1917461 +Patch4: etckeeper-1.18.18-fix-output-for-ansible.patch BuildArch: noarch BuildRequires: %{_bindir}/markdown_py Requires: git-core @@ -290,6 +291,12 @@ fi %changelog +* Fri Dec 2 2022 Thomas Moschny - 1.18.18-1 +- Update to 1.18.18. +- Rebase patches. +- Update patch to fix logging with Ansible (#1917461). +- BuilRequire setuptools when Python >= 3.12. + * Tue Mar 8 2022 Thomas Moschny - 1.18.17-1 - Update to 1.18.17. diff --git a/sources b/sources index 73fac7e..9afa13c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.17.tar.gz) = 6e75d0f38c8d27ba290ab6e1a51d50ca7a736c958da7a1edb792a5c7f1eedd4848adbb43571425f127bf2c5fe39d5b7887968b09178ca5385ec0abeaeb6cfa00 +SHA512 (etckeeper-1.18.18.tar.gz) = 57b2f7297c0b71e3d39a7838dd3e6599bb3f1275d86200be9d7986f46f0392aa0ba130cb38ba7a5757fcb5d6fa33b4d32233237dba15e8ce9fb8c52565cf251b From b0c51ba48d2ed7e9a5ec601a0ce53c614d3de34e Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 28 Jan 2023 10:13:06 +0100 Subject: [PATCH 16/18] Update to 1.18.20. --- etckeeper.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/etckeeper.spec b/etckeeper.spec index 6d566be..c52c9fb 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -17,7 +17,7 @@ %endif Name: etckeeper -Version: 1.18.18 +Version: 1.18.20 Release: 1%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ @@ -291,11 +291,14 @@ fi %changelog +* Sat Jan 28 2023 Thomas Moschny - 1.18.20-1 +- Update to 1.18.20. + * Fri Dec 2 2022 Thomas Moschny - 1.18.18-1 - Update to 1.18.18. - Rebase patches. - Update patch to fix logging with Ansible (#1917461). -- BuilRequire setuptools when Python >= 3.12. +- BuildRequire setuptools when Python >= 3.12. * Tue Mar 8 2022 Thomas Moschny - 1.18.17-1 - Update to 1.18.17. diff --git a/sources b/sources index 9afa13c..5d4192f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.18.tar.gz) = 57b2f7297c0b71e3d39a7838dd3e6599bb3f1275d86200be9d7986f46f0392aa0ba130cb38ba7a5757fcb5d6fa33b4d32233237dba15e8ce9fb8c52565cf251b +SHA512 (etckeeper-1.18.20.tar.gz) = b190da11ac589d6240c8293d961b75efe01e835091f9b5fba84c3c9062ffb4cb1dc52c9ea2bdf881f021c7d5584c4487d3c60121fdcb0a2a35e349c8321422c6 From 3ba7c6cafc0cda4db694249b86607f961ee2f6be Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Tue, 15 Jul 2025 13:13:15 +0200 Subject: [PATCH 17/18] Update to 1.18.22. --- etckeeper.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etckeeper.spec b/etckeeper.spec index c52c9fb..6e53213 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -17,7 +17,7 @@ %endif Name: etckeeper -Version: 1.18.20 +Version: 1.18.22 Release: 1%{?dist} Summary: Store /etc in a SCM system (git, mercurial, bzr or darcs) License: GPLv2+ @@ -291,6 +291,9 @@ fi %changelog +* Tue Jul 15 2025 Thomas Moschny - 1.18.22-1 +- Update to 1.18.22. + * Sat Jan 28 2023 Thomas Moschny - 1.18.20-1 - Update to 1.18.20. From 9fca22b11f1367b087d807328dad2d22182197a0 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Tue, 15 Jul 2025 13:21:23 +0200 Subject: [PATCH 18/18] Update sources. --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 5d4192f..1412813 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (etckeeper-1.18.20.tar.gz) = b190da11ac589d6240c8293d961b75efe01e835091f9b5fba84c3c9062ffb4cb1dc52c9ea2bdf881f021c7d5584c4487d3c60121fdcb0a2a35e349c8321422c6 +SHA512 (etckeeper-1.18.22.tar.gz) = e35ab90862c1f4426c17aec4d9ffe5975c652b290645ac333e9f27fcc157b9eba5e0efe73553a400464102c939f085f4e08f4b04564a015ad6941b1d50dbbe76