summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-07-26 07:56:06 +0000
committerZac Medico <zmedico@gentoo.org>2008-07-26 07:56:06 +0000
commit558ca98706f4d4c05716e8389c642a8eb37bdae5 (patch)
treedbf351dedaf91eea6e484fe56c265c70ca1dfb54
parent5a442f6d4cc5ad074e765ce8ddc0ef52d8b1314c (diff)
downloadportage-558ca98706f4d4c05716e8389c642a8eb37bdae5.tar.gz
portage-558ca98706f4d4c05716e8389c642a8eb37bdae5.tar.bz2
portage-558ca98706f4d4c05716e8389c642a8eb37bdae5.zip
Bug #232924 - When the user specifies a non-existent set, display a list of
existing sets. svn path=/main/trunk/; revision=11197
-rw-r--r--pym/_emerge/__init__.py25
-rw-r--r--pym/portage/exception.py3
2 files changed, 24 insertions, 4 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 9c82a2b7a..d6bb0d382 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -4774,8 +4774,7 @@ class depgraph(object):
if x.startswith(SETPREFIX):
s = x[len(SETPREFIX):]
if s not in sets:
- raise portage.exception.PackageNotFound(
- "emerge: there are no sets to satisfy '%s'." % s)
+ raise portage.exception.PackageSetNotFound(s)
if s in self._sets:
continue
# Recursively expand sets so that containment tests in
@@ -12427,6 +12426,10 @@ def action_build(settings, trees, mtimedb,
except portage.exception.PackageNotFound, e:
portage.writemsg("\n!!! %s\n" % str(e), noiselevel=-1)
return 1
+ except portage.exception.PackageSetNotFound, e:
+ root_config = trees[settings["ROOT"]]["root_config"]
+ display_missing_pkg_set(root_config, e.value)
+ return 1
if show_spinner:
print "\b\b... done!"
if not retval:
@@ -12914,6 +12917,21 @@ def ionice(settings):
out.eerror("PORTAGE_IONICE_COMMAND returned %d" % (rval,))
out.eerror("See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage instructions.")
+def display_missing_pkg_set(root_config, set_name):
+
+ msg = []
+ msg.append(("emerge: There are no sets to satisfy '%s'. " + \
+ "The following sets exist:") % \
+ colorize("INFORM", set_name))
+ msg.append("")
+
+ for s in sorted(root_config.sets):
+ msg.append(" %s" % s)
+ msg.append("")
+
+ writemsg_level("".join("%s\n" % l for l in msg),
+ level=logging.ERROR, noiselevel=-1)
+
def emerge_main():
global portage # NFC why this is necessary now - genone
portage._disable_legacy_globals()
@@ -13092,8 +13110,7 @@ def emerge_main():
if a.startswith(SETPREFIX):
s = a[len(SETPREFIX):]
if s not in sets:
- print "emerge: there are no sets to satisfy %s." % \
- colorize("INFORM", s)
+ display_missing_pkg_set(root_config, s)
return 1
setconfig.active.append(s)
if myaction in unmerge_actions and \
diff --git a/pym/portage/exception.py b/pym/portage/exception.py
index 66cd16244..ff34993a6 100644
--- a/pym/portage/exception.py
+++ b/pym/portage/exception.py
@@ -74,6 +74,9 @@ class PortagePackageException(PortageException):
class PackageNotFound(PortagePackageException):
"""Missing Ebuild or Binary"""
+class PackageSetNotFound(PortagePackageException):
+ """Missing package set"""
+
class InvalidPackageName(PortagePackageException):
"""Malformed package name"""