From fa8a4c3afbe528c1f479b73efa25b269424f0283 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 6 Jan 2009 21:14:33 +0000 Subject: When the set configuration is incomplete, notify the user that this usually means /usr/share/portage/config/sets.conf is missing or corrupt. svn path=/main/trunk/; revision=12384 --- pym/_emerge/__init__.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index d728d64fc..c5c310b07 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -14326,15 +14326,29 @@ def expand_set_arguments(myfiles, myaction, root_config): # emerge relies on the existance of sets with names "world" and "system" required_sets = ("world", "system") + missing_sets = [] for s in required_sets: if s not in sets: - msg = ["emerge: incomplete set configuration, " + \ - "no \"%s\" set defined" % s] + missing_sets.append(s) + if missing_sets: + if len(missing_sets) > 2: + missing_sets_str = ", ".join('"%s"' % s for s in missing_sets[:-1]) + missing_sets_str += ', and "%s"' % missing_sets[-1] + elif len(missing_sets) == 2: + missing_sets_str = '"%s" and "%s"' % tuple(missing_sets) + else: + missing_sets_str = '"%s"' % missing_sets[-1] + msg = ["emerge: incomplete set configuration, " + \ + "missing set(s): %s" % missing_sets_str] + if sets: msg.append(" sets defined: %s" % ", ".join(sets)) - for line in msg: - sys.stderr.write(line + "\n") - retval = 1 + msg.append(" This usually means that '%s'" % \ + (os.path.join(portage.const.GLOBAL_CONFIG_PATH, "sets.conf"),)) + msg.append(" is missing or corrupt.") + for line in msg: + writemsg_level(line + "\n", level=logging.ERROR, noiselevel=-1) + return (None, 1) unmerge_actions = ("unmerge", "prune", "clean", "depclean") for a in myfiles: -- cgit v1.2.3-1-g7c22