Skip to content

Commit

Permalink
Fix handling installonly packages reasons
Browse files Browse the repository at this point in the history
The original code took the first item from all remaining packages.
It means a random reason and use it to keep installonly package reason.

Related: https://issues.redhat.com/browse/RHEL-15902
Closes: #2061
  • Loading branch information
j-mracek authored and m-blaha committed Mar 12, 2024
1 parent 96f8d79 commit a4d815e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dnf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,11 @@ def _goal2transaction(self, goal):
if erasures:
remaining_installed_query = self.sack.query(flags=hawkey.IGNORE_EXCLUDES).installed()
remaining_installed_query.filterm(pkg__neq=erasures)
remaining_installed_query.apply()
for pkg in erasures:
if remaining_installed_query.filter(name=pkg.name):
remaining = remaining_installed_query[0]
tmp_remaining_installed_query = remaining_installed_query.filter(name=pkg.name, arch=pkg.arch)
if tmp_remaining_installed_query:
remaining = tmp_remaining_installed_query[0]
ts.get_reason(remaining)
self.history.set_reason(remaining, ts.get_reason(remaining))
self._ds_callback.pkg_added(pkg, 'e')
Expand Down

0 comments on commit a4d815e

Please sign in to comment.