From 95fc40e39c8535f84e9fc533331fa0464c763af4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 19 May 2006 00:39:05 +0000 Subject: Catch a ValueError thrown from cpv_expand and use it print an error message (to stderr) which includes a list of packages for bug #133731. No changes to quickpkg are necessary because it doesn't get anything from portageq on stdout in this case and it simply assumes there is no match. svn path=/main/trunk/; revision=3376 --- bin/portageq | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/portageq b/bin/portageq index bbf001901..7e75ca2a3 100755 --- a/bin/portageq +++ b/bin/portageq @@ -136,7 +136,14 @@ def match(argv): sys.exit(2) try: print string.join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]),"\n") - except KeyError: + except ValueError, e: + # Multiple matches thrown from cpv_expand + pkgs = e.args[0] + # An error has occurred so we writemsg to stderr and exit nonzero. + portage.writemsg("The following packages available:\n", noiselevel=-1) + for pkg in pkgs: + portage.writemsg("* %s\n" % pkg, noiselevel=-1) + portage.writemsg("\nPlease use a more specific atom.\n", noiselevel=-1) sys.exit(1) match.uses_root = True -- cgit v1.2.3-1-g7c22