richardphibel / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone
Blob Blame History Raw
From 505e534817d076c5190b211983a8a2c930cbe560 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 16 Dec 2019 11:14:33 +0100
Subject: [PATCH] Honor priority with check-update (RhBug:1769466)

Check update is going to use the new query filter that honors repo
priority.

https://bugzilla.redhat.com/show_bug.cgi?id=1769466
---
 dnf.spec                     | 2 +-
 dnf/base.py                  | 4 ++--
 dnf/cli/commands/__init__.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dnf.spec b/dnf.spec
index e20be1e241..57bfd778d4 100644
--- a/dnf.spec
+++ b/dnf.spec
@@ -1,5 +1,5 @@
 # default dependencies
-%global hawkey_version 0.39.1
+%global hawkey_version 0.41.0
 %global libcomps_version 0.1.8
 %global libmodulemd_version 1.4.0
 %global rpm_version 4.14.0
diff --git a/dnf/base.py b/dnf/base.py
index c4ea04181a..1ed01c37a9 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -1365,7 +1365,7 @@ def query_for_repo(query):
 
         # produce the updates list of tuples
         elif pkgnarrow == 'upgrades':
-            updates = query_for_repo(q).upgrades()
+            updates = query_for_repo(q).filterm(upgrades_by_priority=True)
             # reduce a query to security upgrades if they are specified
             updates = self._merge_update_filters(updates)
             # reduce a query to latest packages
@@ -1417,7 +1417,7 @@ def query_for_repo(query):
         elif pkgnarrow == 'obsoletes':
             inst = q.installed()
             obsoletes = query_for_repo(
-                self.sack.query()).filter(obsoletes=inst)
+                self.sack.query()).filter(obsoletes_by_priority=inst)
             # reduce a query to security upgrades if they are specified
             obsoletes = self._merge_update_filters(obsoletes, warning=False)
             obsoletesTuples = []
diff --git a/dnf/cli/commands/__init__.py b/dnf/cli/commands/__init__.py
index 2a0726b654..d71a97f910 100644
--- a/dnf/cli/commands/__init__.py
+++ b/dnf/cli/commands/__init__.py
@@ -279,7 +279,7 @@ def configure(self):
         _checkEnabledRepo(self.base)
 
     def run(self):
-        query = self.base.sack.query().upgrades()
+        query = self.base.sack.query().filterm(upgrades_by_priority=True)
         if self.base.conf.obsoletes:
             obsoleted = query.union(self.base.sack.query().installed())
             obsoletes = self.base.sack.query().filter(obsoletes=obsoleted)