Skip to content

Commit

Permalink
Fix unload plugins behavior without filelists
Browse files Browse the repository at this point in the history
For packages originating outside the System repository, we don't populate the `pkg.files` when running without filelists metadata. Use RPM database as a source instead.
  • Loading branch information
jan-kolarik committed Feb 7, 2024
1 parent 0b4b8cc commit 8db6d2e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dnf/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import logging
import operator
import os
import rpm
import sys
import traceback

Expand Down Expand Up @@ -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__()

Expand Down

0 comments on commit 8db6d2e

Please sign in to comment.