commit: ada871c510ab618493805b70ef0a1e054b5cbe8a Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Sat Apr 22 16:12:58 2023 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Sat Apr 22 16:15:50 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=ada871c5
bugs: better error message when package not found Resolves: https://github.com/pkgcore/pkgdev/issues/134 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgdev/scripts/pkgdev_bugs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py index 173fce8..5b85e52 100644 --- a/src/pkgdev/scripts/pkgdev_bugs.py +++ b/src/pkgdev/scripts/pkgdev_bugs.py @@ -453,10 +453,18 @@ class DependencyGraph: node.file_bug(api_key, auto_cc_arches, observe) +def _parse_targets(search_repo, targets): + for _, target in targets: + try: + yield max(search_repo.itermatch(target)) + except ValueError: + raise ValueError(f"Restriction {target} has no match in repository") + + @bugs.bind_main_func def main(options, out: Formatter, err: Formatter): search_repo = options.search_repo - targets = [max(search_repo.itermatch(target)) for _, target in options.targets] + targets = list(_parse_targets(search_repo, options.targets)) d = DependencyGraph(out, err, options) d.build_full_graph(targets) d.merge_cycles()
