Merge the internal package set changes from trunk r14614 (bug #266454). None
authorZac Medico <zmedico@gentoo.org>
Sun, 18 Oct 2009 03:54:13 +0000 (03:54 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 18 Oct 2009 03:54:13 +0000 (03:54 -0000)
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
pym/_emerge/actions.py
pym/_emerge/create_world_atom.py
pym/_emerge/depgraph.py
pym/_emerge/unmerge.py
pym/portage/_sets/__init__.py
pym/portage/_sets/files.py

index bfcba9f3e1aad31d127f13e99c71ad1218dd70aa..69bba4a1bfa814f4008c10b88f4348642989c9b9 100644 (file)
@@ -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()
index bae996be7b790f57a398a76170a7869969092256..faaf3f84586ec70fde6f55dc83a80f133b88813a 100644 (file)
@@ -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
 
index 30ade0acf4413fc11494b8e8b23b4613296359cd..7ded8af13af93295d5e0d34b862e633bc2bce4ed 100644 (file)
@@ -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:
index 7bbfde4e8446190e171648888da251d2e55bde67..2236bff0e794dd3ffd5f3b6a9b09c30583d5308d 100644 (file)
@@ -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:
index caf6e8e6895349bd338d4967054ff38ee61fc600..ef8b92cc59f8db6a80a3f189fcd5c00673308e92 100644 (file)
@@ -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
 
index 2298aef72488ff7da4359dcdb050fe1420ad2cec..9e971451d9cdaa79192fe206e8cb23b6a8ffac05 100644 (file)
@@ -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
index 396c2c17db5abfeb3037c730e0d95e474b8899a4..29cb1dde033110280259aa5717b3bdf64bb20f30 100644 (file)
@@ -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)