From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 03563158013 for ; Fri, 15 Dec 2023 11:42:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4B5BE2BC020; Fri, 15 Dec 2023 11:42:43 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2E75F2BC020 for ; Fri, 15 Dec 2023 11:42:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A5FD335DEB for ; Fri, 15 Dec 2023 11:42:42 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D0778ACA for ; Fri, 15 Dec 2023 11:42:40 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1702640554.c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgdev:main commit in: src/pkgdev/scripts/ X-VCS-Repository: proj/pkgcore/pkgdev X-VCS-Files: src/pkgdev/scripts/pkgdev_bugs.py X-VCS-Directories: src/pkgdev/scripts/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a X-VCS-Branch: main Date: Fri, 15 Dec 2023 11:42:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1b4c716c-a63d-4473-bccb-547e88edf614 X-Archives-Hash: dad3d212168f744d8f04436fceb3087e commit: c9fdcf2edf1f43cde2e8eef1c709ba33c47b5f8a Author: Arthur Zamarin gentoo org> AuthorDate: Fri Dec 15 11:42:34 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Fri Dec 15 11:42:34 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=c9fdcf2e bugs: prefer using user selected targets Resolves: https://github.com/pkgcore/pkgdev/issues/161 Signed-off-by: Arthur Zamarin 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 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] = {}