diff --git a/dnf/plugin.py b/dnf/plugin.py index d2f46ce340..68cd33422d 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,18 @@ 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): + hdr = dnf.util.first(pkg.base._ts.dbMatch('name', pkg.name)) + return hdr[rpm.RPMTAG_FILENAMES] if hdr else [] + + def _plugin_classes(): return Plugin.__subclasses__()