From b330c160cdbf58f644f5d9cc108c2d3fbe2ba44d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 18 Oct 2009 03:54:13 +0000 Subject: [PATCH] Merge the internal package set changes from trunk r14614 (bug #266454). None of these changes should be noticeable to users. This is just to keep the diff relative to trunk as small as possible. svn path=/main/branches/2.1.7/; revision=14642 --- pym/_emerge/Scheduler.py | 2 +- pym/_emerge/actions.py | 10 +++++----- pym/_emerge/create_world_atom.py | 2 +- pym/_emerge/depgraph.py | 21 +++++++++++---------- pym/_emerge/unmerge.py | 24 ++++++++++++------------ pym/portage/_sets/__init__.py | 13 +++++++++---- pym/portage/_sets/files.py | 10 +++++----- 7 files changed, 44 insertions(+), 38 deletions(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index bfcba9f3e..69bba4a1b 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1629,7 +1629,7 @@ class Scheduler(PollScheduler): logger = self._logger pkg_count = self._pkg_count root_config = pkg.root_config - world_set = root_config.sets["world"] + world_set = root_config.sets["selected"] world_locked = False if hasattr(world_set, "lock"): world_set.lock() diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index bae996be7..faaf3f845 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -617,7 +617,7 @@ def action_depclean(settings, trees, ldpath_mtimes, print("Packages installed: " + str(len(vardb.cpv_all()))) print("Packages in world: " + \ - str(len(root_config.sets["world"].getAtoms()))) + str(len(root_config.sets["selected"].getAtoms()))) print("Packages in system: " + \ str(len(root_config.sets["system"].getAtoms()))) print("Required packages: "+str(req_pkg_count)) @@ -637,7 +637,7 @@ def calc_depclean(settings, trees, ldpath_mtimes, vardb = trees[myroot]["vartree"].dbapi deselect = myopts.get('--deselect') != 'n' - required_set_names = ("system", "world") + required_set_names = ("world",) required_sets = {} set_args = [] @@ -650,7 +650,7 @@ def calc_depclean(settings, trees, ldpath_mtimes, # which excludes packages that are intended to be eligible for # removal. world_temp_set = required_sets["world"] - system_set = required_sets["system"] + system_set = root_config.sets["system"] if not system_set or not world_temp_set: @@ -997,9 +997,9 @@ def calc_depclean(settings, trees, ldpath_mtimes, def action_deselect(settings, trees, opts, atoms): root_config = trees[settings['ROOT']]['root_config'] - world_set = root_config.sets['world'] + world_set = root_config.sets['selected'] if not hasattr(world_set, 'update'): - writemsg_level("World set does not appear to be mutable.\n", + writemsg_level("World @selected set does not appear to be mutable.\n", level=logging.ERROR, noiselevel=-1) return 1 diff --git a/pym/_emerge/create_world_atom.py b/pym/_emerge/create_world_atom.py index 30ade0acf..7ded8af13 100644 --- a/pym/_emerge/create_world_atom.py +++ b/pym/_emerge/create_world_atom.py @@ -68,7 +68,7 @@ def create_world_atom(pkg, args_set, root_config): if len(matched_slots) == 1: new_world_atom = slot_atom - if new_world_atom == sets["world"].findAtomForPackage(pkg): + if new_world_atom == sets["selected"].findAtomForPackage(pkg): # Both atoms would be identical, so there's nothing to add. return None if not slotted: diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 7bbfde4e8..2236bff0e 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -90,7 +90,7 @@ class _frozen_depgraph_config(object): self.pkgsettings[myroot] = portage.config( clone=self.trees[myroot]["vartree"].settings) - self._required_set_names = set(["system", "world"]) + self._required_set_names = set(["world"]) class _dynamic_depgraph_config(object): @@ -1756,7 +1756,7 @@ class depgraph(object): continue if not (isinstance(arg, SetArg) and \ - arg.name in ("system", "world")): + arg.name in ("selected", "system", "world")): self._dynamic_config._unsatisfied_deps_for_display.append( ((myroot, atom), {})) return 0, myfavorites @@ -1783,7 +1783,7 @@ class depgraph(object): # out here if the atom is not from either the system or # world set. if not (isinstance(arg, SetArg) and \ - arg.name in ("system", "world")): + arg.name in ("selected", "system", "world")): return 0, myfavorites # Add the selected package to the graph as soon as possible @@ -3486,7 +3486,7 @@ class depgraph(object): skip = False try: for atom in root_config.sets[ - "world"].iterAtomsForPackage(task): + "selected"].iterAtomsForPackage(task): satisfied = False for pkg in graph_db.match_pkgs(atom): if pkg == inst_pkg: @@ -4428,7 +4428,7 @@ class depgraph(object): pkg_cp = xs[0] root_config = self._frozen_config.roots[myroot] system_set = root_config.sets["system"] - world_set = root_config.sets["world"] + world_set = root_config.sets["selected"] pkg_system = False pkg_world = False @@ -4647,9 +4647,9 @@ class depgraph(object): if "world" in self._dynamic_config._sets: # Filter out indirect members of world (from nested sets) # since only direct members of world are desired here. - world_set = self._frozen_config.roots[self._frozen_config.target_root].sets["world"] + world_set = self._frozen_config.roots[self._frozen_config.target_root].sets["selected"] for arg, atom in self._dynamic_config._missing_args: - if arg.name == "world" and atom in world_set: + if arg.name in ("selected", "world") and atom in world_set: world_problems = True break @@ -4698,7 +4698,7 @@ class depgraph(object): ref_string = " pulled in by " + ref_string msg.append(" %s%s\n" % (colorize("INFORM", str(arg)), ref_string)) msg.append("\n") - if "world" in problems_sets: + if "selected" in problems_sets or "world" in problems_sets: msg.append("This problem can be solved in one of the following ways:\n\n") msg.append(" A) Use emaint to clean offending packages from world (if not installed).\n") msg.append(" B) Uninstall offending packages (cleans them from world).\n") @@ -4729,7 +4729,7 @@ class depgraph(object): if x in self._frozen_config.myopts: return root_config = self._frozen_config.roots[self._frozen_config.target_root] - world_set = root_config.sets["world"] + world_set = root_config.sets["selected"] world_locked = False if hasattr(world_set, "lock"): @@ -4761,7 +4761,8 @@ class depgraph(object): del e all_added = [] for k in self._dynamic_config._sets: - if k in ("args", "world") or not root_config.sets[k].world_candidate: + if k in ("args", "selected", "world") or \ + not root_config.sets[k].world_candidate: continue s = SETPREFIX + k if s in world_set: diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py index caf6e8e68..ef8b92cc5 100644 --- a/pym/_emerge/unmerge.py +++ b/pym/_emerge/unmerge.py @@ -424,22 +424,22 @@ def unmerge(root_config, myopts, unmerge_action, raise UninstallFailure(retval) sys.exit(retval) else: - if clean_world and hasattr(sets["world"], "cleanPackage")\ - and hasattr(sets["world"], "lock"): - sets["world"].lock() - if hasattr(sets["world"], "load"): - sets["world"].load() - sets["world"].cleanPackage(vartree.dbapi, y) - sets["world"].unlock() + if clean_world and hasattr(sets["selected"], "cleanPackage")\ + and hasattr(sets["selected"], "lock"): + sets["selected"].lock() + if hasattr(sets["selected"], "load"): + sets["selected"].load() + sets["selected"].cleanPackage(vartree.dbapi, y) + sets["selected"].unlock() emergelog(xterm_titles, " >>> unmerge success: "+y) - if clean_world and hasattr(sets["world"], "remove")\ - and hasattr(sets["world"], "lock"): - sets["world"].lock() + if clean_world and hasattr(sets["selected"], "remove")\ + and hasattr(sets["selected"], "lock"): + sets["selected"].lock() # load is called inside remove() for s in root_config.setconfig.active: - sets["world"].remove(SETPREFIX+s) - sets["world"].unlock() + sets["selected"].remove(SETPREFIX + s) + sets["selected"].unlock() return 1 diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py index 2298aef72..9e971451d 100644 --- a/pym/portage/_sets/__init__.py +++ b/pym/portage/_sets/__init__.py @@ -40,14 +40,19 @@ class SetConfig(object): # system and world sets is hardcoded below. parser = self._parser + parser.add_section("world") + parser.set("world", "class", "portage._sets.base.DummyPackageSet") + parser.set("world", "world-candidate", "False") + parser.set("world", "packages", "@selected @system") + + parser.add_section("selected") + parser.set("selected", "class", "portage._sets.files.WorldSelectedSet") + parser.set("selected", "world-candidate", "False") + parser.add_section("system") parser.set("system", "class", "portage._sets.profiles.PackagesSystemSet") parser.set("system", "world-candidate", "False") - parser.add_section("world") - parser.set("world", "class", "portage._sets.files.WorldSet") - parser.set("world", "world-candidate", "False") - self.errors = [] self.psets = {} self.trees = trees diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py index 396c2c17d..29cb1dde0 100644 --- a/pym/portage/_sets/files.py +++ b/pym/portage/_sets/files.py @@ -21,13 +21,13 @@ from portage.env.loaders import ItemFileLoader, KeyListFileLoader from portage.env.validators import ValidAtomValidator from portage import dep_getkey, cpv_getkey -__all__ = ["WorldSet",] +__all__ = ["WorldSelectedSet",] -class WorldSet(EditablePackageSet): +class WorldSelectedSet(EditablePackageSet): description = "Set of packages that were directly installed by the user" def __init__(self, root): - super(WorldSet, self).__init__() + super(WorldSelectedSet, self).__init__() # most attributes exist twice as atoms and non-atoms are stored in # separate files self._lock = None @@ -44,7 +44,7 @@ class WorldSet(EditablePackageSet): def load(self): atoms = [] - nonatoms = ["@system"] + nonatoms = [] atoms_changed = False # load atoms and non-atoms from different files so the worldfile is # backwards-compatible with older versions and other PMs, even though @@ -115,5 +115,5 @@ class WorldSet(EditablePackageSet): self.replace(newworldlist) def singleBuilder(self, options, settings, trees): - return WorldSet(settings["ROOT"]) + return WorldSelectedSet(settings["ROOT"]) singleBuilder = classmethod(singleBuilder) -- 2.26.2