Fix create_world_atom() to take a Package instance in it's arguments.
authorZac Medico <zmedico@gentoo.org>
Sat, 31 May 2008 20:15:45 +0000 (20:15 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 31 May 2008 20:15:45 +0000 (20:15 -0000)
(trunk r10521)

svn path=/main/branches/2.1.2/; revision=10522

bin/emerge

index 886d2a2ef9877c0330d20e53f53a5c5f62a0c7f2..22b9113094990cb8b7567edd403f5dc881cec3dc 100755 (executable)
@@ -902,15 +902,14 @@ class RootConfig(object):
                self.sets = self.setconfig.getSets()
                self.visible_pkgs = PackageVirtualDbapi(self.settings)
 
-def create_world_atom(pkg_key, metadata, args_set, root_config):
+def create_world_atom(pkg, args_set, root_config):
        """Create a new atom for the world file if one does not exist.  If the
        argument atom is precise enough to identify a specific slot then a slot
        atom will be returned. Atoms that are in the system set may also be stored
        in world since system atoms can only match one slot while world atoms can
        be greedy with respect to slots.  Unslotted system packages will not be
        stored in world."""
-       pkg = Package(cpv=pkg_key, root_config=root_config, metadata=metadata)
-       metadata = pkg.metadata
+
        arg_atom = args_set.findAtomForPackage(pkg)
        if not arg_atom:
                return None
@@ -932,7 +931,7 @@ def create_world_atom(pkg_key, metadata, args_set, root_config):
        if slotted and arg_atom != cp:
                # If the user gave a specific atom, store it as a
                # slot atom in the world file.
-               slot_atom = "%s:%s" % (cp, metadata["SLOT"])
+               slot_atom = pkg.slot_atom
 
                # For USE=multislot, there are a couple of cases to
                # handle here:
@@ -5013,8 +5012,7 @@ class depgraph(object):
                                                myroot == self.target_root and \
                                                favorites_set.findAtomForPackage(pkg):
                                                # Maybe it will be added to world now.
-                                               if create_world_atom(pkg_key, metadata,
-                                                       favorites_set, root_config):
+                                               if create_world_atom(pkg, favorites_set, root_config):
                                                        pkg_world = True
                                except portage_exception.InvalidDependString:
                                        # This is reported elsewhere if relevant.
@@ -5313,10 +5311,9 @@ class depgraph(object):
                        pkg_type, root, pkg_key, pkg_status = x
                        if pkg_status != "nomerge":
                                continue
-                       metadata = x.metadata
+
                        try:
-                               myfavkey = create_world_atom(pkg_key, metadata,
-                                       args_set, root_config)
+                               myfavkey = create_world_atom(pkg, args_set, root_config)
                                if myfavkey:
                                        if myfavkey in added_favorites:
                                                continue
@@ -6257,8 +6254,7 @@ class MergeTask(object):
                                        args_set.findAtomForPackage(pkg):
                                        world_set.lock()
                                        world_set.load()
-                                       myfavkey = create_world_atom(pkg_key, metadata,
-                                               args_set, root_config)
+                                       myfavkey = create_world_atom(pkg, args_set, root_config)
                                        if myfavkey:
                                                world_set.add(myfavkey)
                                                print ">>> Recording",myfavkey,"in \"world\" favorites file..."