From bb2b0ce4fe9890c6bd27293c0b6e47659130280f Mon Sep 17 00:00:00 2001 From: idl0r Date: Wed, 31 Mar 2010 12:45:41 +0000 Subject: [PATCH] epkginfo: Fix epkginfo to handle ambiguous package names. svn path=/trunk/gentoolkit/; revision=762 --- ChangeLog | 3 +++ bin/epkginfo | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 63d781c..a011ed5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-03-31: Christian Ruppert + * epkginfo: Fix epkginfo to handle ambiguous package names. + 2010-03-09: Paul Varner * gentoolkit: Add inital py3k support. * analyse: Add new analyse utility from dol-sen. This will probably diff --git a/bin/epkginfo b/bin/epkginfo index 30f2ab5..953b4a4 100755 --- a/bin/epkginfo +++ b/bin/epkginfo @@ -21,6 +21,7 @@ import sys from gentoolkit import equery, errors from gentoolkit.equery import mod_usage from gentoolkit.equery.meta import main, print_help +from portage.exception import AmbiguousPackageName def print_epkginfo_help(): print(mod_usage(mod_name="epkginfo")) @@ -34,6 +35,18 @@ if not args or set(('-h', '--help')).intersection(args): else: try: main(args) + except AmbiguousPackageName as e: + pkgs = e.args[0] + for candidate in pkgs: + print(candidate) + + from gentoolkit import pprinter as pp + from os.path import basename # To get the short name + + print(file=sys.stderr) + print(pp.error("The short ebuild name '%s' is ambiguous. Please specify" % basename(pkgs[0])), + file=sys.stderr, end="") + pp.die(1, "one of the above fully-qualified ebuild names instead.") except errors.GentoolkitException as err: from gentoolkit import pprinter as pp pp.die(1, str(err)) -- 2.26.2