From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1510511-garchives=archives.gentoo.org@lists.gentoo.org> 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 9AA8315ACFB for <garchives@archives.gentoo.org>; Sat, 22 Apr 2023 16:32:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DD063E0891; Sat, 22 Apr 2023 16:32:52 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 pigeon.gentoo.org (Postfix) with ESMTPS id C77ACE0891 for <gentoo-commits@lists.gentoo.org>; Sat, 22 Apr 2023 16:32:52 +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 17CD2341303 for <gentoo-commits@lists.gentoo.org>; Sat, 22 Apr 2023 16:32:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A8505A3F for <gentoo-commits@lists.gentoo.org>; Sat, 22 Apr 2023 16:32:50 +0000 (UTC) From: "Arthur Zamarin" <arthurzam@gentoo.org> 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" <arthurzam@gentoo.org> Message-ID: <1682181130.a691a6cca142370e3790a879bf0f05961b76a8c0.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: a691a6cca142370e3790a879bf0f05961b76a8c0 X-VCS-Branch: main Date: Sat, 22 Apr 2023 16:32:50 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 59d2c2c5-33ca-41ed-9fb2-c91eb2473b6b X-Archives-Hash: bfabd5534dbb092d76c9ccec535b59e2 commit: a691a6cca142370e3790a879bf0f05961b76a8c0 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Sat Apr 22 16:32:10 2023 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Sat Apr 22 16:32:10 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=a691a6cc bugs: fix restriction passing to find_best_match Resolves: https://github.com/pkgcore/pkgdev/issues/131 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgdev/scripts/pkgdev_bugs.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py index 5b85e52..4a7f34c 100644 --- a/src/pkgdev/scripts/pkgdev_bugs.py +++ b/src/pkgdev/scripts/pkgdev_bugs.py @@ -250,7 +250,7 @@ class DependencyGraph: def find_best_match(self, restrict, pkgset: list[package]) -> package: restrict = boolean.AndRestriction( - restrict, + *restrict, packages.PackageRestriction("properties", values.ContainmentMatch("live", negate=True)), ) # prefer using already selected packages in graph @@ -276,13 +276,21 @@ class DependencyGraph: for pkgname, problems in issues.items(): pkgset: list[package] = self.options.repo.match(atom(pkgname)) try: - combined = boolean.AndRestriction(*set().union(*problems.values())) - match = self.find_best_match(combined, pkgset) + match = self.find_best_match(set().union(*problems.values()), pkgset) yield match, set(problems.keys()) except (ValueError, IndexError): results: dict[package, set[str]] = defaultdict(set) for keyword, deps in problems.items(): - match = self.find_best_match(deps, pkgset) + try: + match = self.find_best_match(deps, pkgset) + except (ValueError, IndexError): + deps_str = " , ".join(map(str, deps)) + self.err.write( + self.err.fg("red"), + f"unable to find match for restrictions: {deps_str}", + self.err.reset, + ) + raise results[match].add(keyword) yield from results.items()