Skip to content

Commit

Permalink
Use installed_all because installed_query is filtered user input
Browse files Browse the repository at this point in the history
`installed_query` could be missing packages. If we specify we want to
upgrade a specific nevra that is not yet installed, then `installed_query`
is empty because it is based on user input, but there could be other
versions of the pkg installed.

Eg: if kernel-1 and kernel-3 are installed and we specify we want to
upgrade kernel-2, nothing should be done because we already have higher
version, but now `installed_query` would be empty and kernel-2 would be
installed.

Therefore, we need to use `installed_all`.
  • Loading branch information
kontura authored and j-mracek committed Jul 19, 2022
1 parent 20d99dc commit 75df22d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dnf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ def _upgrade_internal(self, query, obsoletes, reponame, pkg_spec=None):
# packages. Otherwise if for example kernel-1 and kernel-3 were installed and present in the
# transaction libsolv could decide to install kernel-2 because it is an upgrade for kernel-1 even
# though we don't want it because there already is a newer version present.
query = query.union(installed_query.latest().filter(name=[pkg.name for pkg in query]))
query = query.union(installed_all.latest().filter(name=[pkg.name for pkg in query]))
sltr = dnf.selector.Selector(self.sack)
sltr.set(pkg=query)
self._goal.upgrade(select=sltr)
Expand Down

0 comments on commit 75df22d

Please sign in to comment.