diff options
author | Petr Spacek <pspacek@redhat.com> | 2014-10-28 21:23:18 +0100 |
---|---|---|
committer | Petr Spacek <pspacek@redhat.com> | 2014-10-28 21:23:32 +0100 |
commit | 0ef878020877de725ff244c4d3f44697b6efd3ab (patch) | |
tree | 3d6f38d13a18af5404d952a704f4d6d94b423bee | |
parent | 603f897997813af626e6855c4f8a8add08a045bb (diff) |
add support for DNF package manager
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | etckeeper-dnf/__init__.py | 0 | ||||
-rw-r--r-- | etckeeper-dnf/etckeeper.py | 39 | ||||
-rw-r--r-- | etckeeper.conf | 2 |
4 files changed, 44 insertions, 1 deletions
@@ -17,6 +17,7 @@ PYTHON=python build: etckeeper.spec -$(PYTHON) ./etckeeper-bzr/__init__.py build || echo "** bzr support not built" + -$(PYTHON) ./etckeeper-dnf/etckeeper.py build || echo "** DNF support not built" install: mkdir -p $(DESTDIR)$(etcdir)/etckeeper/ $(DESTDIR)$(vardir)/cache/etckeeper/ @@ -44,6 +45,9 @@ 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 diff --git a/etckeeper-dnf/__init__.py b/etckeeper-dnf/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/etckeeper-dnf/__init__.py diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py new file mode 100644 index 0000000..b31c3b0 --- /dev/null +++ b/etckeeper-dnf/etckeeper.py @@ -0,0 +1,39 @@ +# etckeeper.py, support etckeeper for dnf +# +# Copyright (C) 2014 Peter Listiak +# https://github.com/plistiak/dnf-etckeeper +# +# Later modifications by Petr Spacek: +# Distutils code below was copied from etckeeper-bzr distributed with v1.15 +# + +from dnfpluginscore import logger + +import os +import dnf + + +class Etckeeper(dnf.Plugin): + + name = 'etckeeper' + + def _out(self, msg): + logger.debug('Etckeeper plugin: %s', msg) + + 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)) + + def transaction(self): + self._out('post transaction commit') + command = '%s %s > /dev/null' % ('etckeeper', "post-install") + os.system(command) + +if __name__ == "__main__": + from distutils.core import setup + setup(name="dnf-etckeeper", + packages=["dnf.plugin"], + package_dir={"dnf.plugin":"etckeeper-dnf"}) diff --git a/etckeeper.conf b/etckeeper.conf index f988c10..2aec35e 100644 --- a/etckeeper.conf +++ b/etckeeper.conf @@ -30,7 +30,7 @@ DARCS_COMMIT_OPTIONS="-a" #AVOID_COMMIT_BEFORE_INSTALL=1 # The high-level package manager that's being used. -# (apt, pacman-g2, yum, zypper etc) +# (apt, pacman-g2, yum, dnf, zypper etc) HIGHLEVEL_PACKAGE_MANAGER=apt # The low-level package manager that's being used. |