From 8b504142de5a1a9ea3723f71cb5d73bf3c27af1d Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Wed, 21 Sep 2022 01:51:44 +0200 Subject: [PATCH] packages: filter_pkgbuilds(): track which queries were matched and error on incompletely satisified queries --- packages/pkgbuild.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/pkgbuild.py b/packages/pkgbuild.py index 84aac8e..3dfc5b5 100644 --- a/packages/pkgbuild.py +++ b/packages/pkgbuild.py @@ -416,6 +416,7 @@ def filter_pkgbuilds( all_pkgs = [pkg for pkg in all_pkgs if set([arch, 'any']).intersection(pkg.arches)] return all_pkgs result = [] + to_find = list(paths) for pkg in repo.values(): comparison = set() if use_paths: @@ -429,7 +430,13 @@ def filter_pkgbuilds( logging.warn(f"Pkg {pkg.name} matches query {matches[0]} but isn't available for architecture {arch}: {pkg.arches}") continue result += [pkg] + for m in matches: + to_find.remove(m) + + if not allow_empty_results: + if not result: + raise Exception(f'No packages matched by {fields_err}: ' + ', '.join([f'"{p}"' for p in paths])) + if to_find: + raise Exception(f"No packagages matched by {fields_err}: " + ', '.join([f'"{p}"' for p in to_find])) - if not allow_empty_results and not result: - raise Exception(f'No packages matched by {fields_err}: ' + ', '.join([f'"{p}"' for p in paths])) return result