Skip to content

Commit a691a6c

Browse files
committed
bugs: fix restriction passing to find_best_match
Resolves: #131 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent ada871c commit a691a6c

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/pkgdev/scripts/pkgdev_bugs.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def mk_fake_pkg(self, pkg: package, keywords: set[str]):
250250

251251
def find_best_match(self, restrict, pkgset: list[package]) -> package:
252252
restrict = boolean.AndRestriction(
253-
restrict,
253+
*restrict,
254254
packages.PackageRestriction("properties", values.ContainmentMatch("live", negate=True)),
255255
)
256256
# prefer using already selected packages in graph
@@ -276,13 +276,21 @@ def _find_dependencies(self, pkg: package, keywords: set[str]):
276276
for pkgname, problems in issues.items():
277277
pkgset: list[package] = self.options.repo.match(atom(pkgname))
278278
try:
279-
combined = boolean.AndRestriction(*set().union(*problems.values()))
280-
match = self.find_best_match(combined, pkgset)
279+
match = self.find_best_match(set().union(*problems.values()), pkgset)
281280
yield match, set(problems.keys())
282281
except (ValueError, IndexError):
283282
results: dict[package, set[str]] = defaultdict(set)
284283
for keyword, deps in problems.items():
285-
match = self.find_best_match(deps, pkgset)
284+
try:
285+
match = self.find_best_match(deps, pkgset)
286+
except (ValueError, IndexError):
287+
deps_str = " , ".join(map(str, deps))
288+
self.err.write(
289+
self.err.fg("red"),
290+
f"unable to find match for restrictions: {deps_str}",
291+
self.err.reset,
292+
)
293+
raise
286294
results[match].add(keyword)
287295
yield from results.items()
288296

0 commit comments

Comments
 (0)