commit:     ff924c6605fb8f99c07e84adbf446f3a6ff5e47b
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 28 16:45:33 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 28 16:45:33 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=ff924c66

bugs: when selecting matching package, prefer those that have keywords

Resolves: https://github.com/pkgcore/pkgdev/issues/205
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgdev/scripts/pkgdev_bugs.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/pkgdev/scripts/pkgdev_bugs.py 
b/src/pkgdev/scripts/pkgdev_bugs.py
index 6864ba7..e805594 100644
--- a/src/pkgdev/scripts/pkgdev_bugs.py
+++ b/src/pkgdev/scripts/pkgdev_bugs.py
@@ -385,10 +385,15 @@ class DependencyGraph:
         if intersect := tuple(filter(restrict.match, all_pkgs)):
             return max(intersect)
         matches = sorted(filter(restrict.match, pkgset), reverse=True)
+        # prefer package with any stable keyword
         if prefer_semi_stable:
             for match in matches:
                 if not all(keyword.startswith("~") for keyword in 
match.keywords):
                     return match
+        # prefer package with any keyword
+        for match in matches:
+            if match.keywords:
+                return match
         return matches[0]
 
     def extend_targets_stable_groups(self, groups):

Reply via email to