diff options
author | 2023-12-15 13:42:34 +0200 | |
---|---|---|
committer | 2023-12-15 13:42:34 +0200 | |
commit | c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a (patch) | |
tree | 13dac631437d834769dfc0e0ef9fde36d3c4634e | |
parent | bugs: mention age of packages in the bug description (diff) | |
download | pkgdev-c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a.tar.gz pkgdev-c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a.tar.bz2 pkgdev-c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a.zip |
bugs: prefer using user selected targets
Resolves: https://github.com/pkgcore/pkgdev/issues/161
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | src/pkgdev/scripts/pkgdev_bugs.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py index 924e9e4..6f444e9 100644 --- a/src/pkgdev/scripts/pkgdev_bugs.py +++ b/src/pkgdev/scripts/pkgdev_bugs.py @@ -279,6 +279,7 @@ class DependencyGraph: self.nodes: set[GraphNode] = set() self.starting_nodes: set[GraphNode] = set() + self.targets: tuple[package] = () def mk_fake_pkg(self, pkg: package, keywords: set[str]): return FakePkg( @@ -295,6 +296,9 @@ class DependencyGraph: *restrict, packages.PackageRestriction("properties", values.ContainmentMatch("live", negate=True)), ) + # prefer using user selected targets + if intersect := tuple(filter(restrict.match, self.targets)): + return max(intersect) # prefer using already selected packages in graph all_pkgs = (pkg for node in self.nodes for pkg, _ in node.pkgs) if intersect := tuple(filter(restrict.match, all_pkgs)): @@ -345,6 +349,7 @@ class DependencyGraph: yield from results.items() def build_full_graph(self, targets: list[package]): + self.targets = tuple(targets) check_nodes = [(pkg, set()) for pkg in targets] vertices: dict[package, GraphNode] = {} |