diff --git a/dnf/plugin.py b/dnf/plugin.py index d2f46ce340..31c2c2378f 100644 --- a/dnf/plugin.py +++ b/dnf/plugin.py @@ -29,6 +29,7 @@ import logging import operator import os +import rpm import sys import traceback @@ -193,13 +194,20 @@ def unload_removed_plugins(self, transaction): # check whether removed plugin file is added at the same time (upgrade of a plugin) for pkg in transaction.install_set: - erased_plugin_files.difference_update(pkg.files) + erased_plugin_files.difference_update(_get_files_from_newly_installed_pkg(pkg)) # unload plugins that were removed in transaction for plugin_file in erased_plugin_files: self.plugins.remove(plugins[plugin_file]) +def _get_files_from_newly_installed_pkg(pkg): + hdrs = pkg.base._ts.dbMatch('name', pkg.name) + if not hdrs: + return [] + return next(hdrs)[rpm.RPMTAG_FILENAMES] + + def _plugin_classes(): return Plugin.__subclasses__()