From 16e1f2185bb7ed36d3119b29a50ca0ff75fa8b71 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 12 Mar 2013 22:10:08 -0700 Subject: [PATCH] expand_set_arguments: defer set load for depgraph This allows the depgraph to display the "Calculating dependencies" message before sets are loaded, as discussed in bug #461412. --- pym/_emerge/actions.py | 12 +++++++++--- pym/_emerge/depgraph.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 7fe8e8388..d7d248af2 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -3340,7 +3340,7 @@ def expand_set_arguments(myfiles, myaction, root_config): # world file, the depgraph performs set expansion later. It will get # confused about where the atoms came from if it's not allowed to # expand them itself. - do_not_expand = (None, ) + do_not_expand = myaction is None newargs = [] for a in myfiles: if a in ("system", "world"): @@ -3406,6 +3406,14 @@ def expand_set_arguments(myfiles, myaction, root_config): for line in textwrap.wrap(msg, 50): out.ewarn(line) setconfig.active.append(s) + + if do_not_expand: + # Loading sets can be slow, so skip it here, in order + # to allow the depgraph to indicate progress with the + # spinner while sets are loading (bug #461412). + newargs.append(a) + continue + try: set_atoms = setconfig.getSetAtoms(s) except portage.exception.PackageSetNotFound as e: @@ -3426,8 +3434,6 @@ def expand_set_arguments(myfiles, myaction, root_config): retval = 1 elif not set_atoms: print("emerge: '%s' is an empty set" % s) - elif myaction not in do_not_expand: - newargs.extend(set_atoms) else: newargs.append(SETPREFIX+s) for e in sets[s].errors: diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 965d3bcef..7e3a0eb1a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2714,6 +2714,29 @@ class depgraph(object): raise portage.exception.PackageSetNotFound(s) if s in depgraph_sets.sets: continue + + try: + set_atoms = root_config.setconfig.getSetAtoms(s) + except portage.exception.PackageSetNotFound as e: + writemsg_level("\n\n", level=logging.ERROR, + noiselevel=-1) + for pset in list(depgraph_sets.sets.values()) + [sets[s]]: + for error_msg in pset.errors: + sys.stderr.write("%s\n" % (error_msg,)) + + writemsg_level(("emerge: the given set '%s' " + "contains a non-existent set named '%s'.\n") % \ + (s, e), level=logging.ERROR, noiselevel=-1) + if s in ('world', 'selected') and \ + SETPREFIX + e.value in sets['selected']: + writemsg_level(("Use `emerge --deselect %s%s` to " + "remove this set from world_sets.\n") % + (SETPREFIX, e,), level=logging.ERROR, + noiselevel=-1) + writemsg_level("\n", level=logging.ERROR, + noiselevel=-1) + return False, myfavorites + pset = sets[s] depgraph_sets.sets[s] = pset args.append(SetArg(arg=x, pset=pset, @@ -7031,6 +7054,11 @@ class depgraph(object): self._display_autounmask() + for depgraph_sets in self._dynamic_config.sets.values(): + for pset in depgraph_sets.sets.values(): + for e in pset.errors: + sys.stderr.write("%s\n" % (e,)) + # TODO: Add generic support for "set problem" handlers so that # the below warnings aren't special cases for world only. -- 2.26.2