When deciding if a package is slotted inside create_world_atom(), check the vdb in...
authorZac Medico <zmedico@gentoo.org>
Sun, 15 Jul 2007 03:22:43 +0000 (03:22 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 15 Jul 2007 03:22:43 +0000 (03:22 -0000)
svn path=/main/branches/2.1.2/; revision=7264

bin/emerge

index 187d7e97b02ec88af7397a272ff954441929d1de..7bdceda96ad372330ed20a37c5cfab8128cb8012 100755 (executable)
@@ -687,7 +687,7 @@ class RootConfig(object):
                system_set = SystemSet(self.settings)
                self.sets["system"] = system_set
 
-def create_world_atom(pkg_key, metadata, args_set, sets, portdb):
+def create_world_atom(pkg_key, metadata, 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
@@ -697,9 +697,19 @@ def create_world_atom(pkg_key, metadata, args_set, sets, portdb):
        arg_atom = args_set.findAtomForPackage(pkg_key, metadata)
        cp = portage.dep_getkey(arg_atom)
        new_world_atom = cp
+       sets = root_config.sets
+       portdb = root_config.trees["porttree"].dbapi
+       vardb = root_config.trees["vartree"].dbapi
        available_slots = set(portdb.aux_get(cpv, ["SLOT"])[0] \
                for cpv in portdb.match(cp))
-       slotted = len(available_slots) > 1 or "0" not in available_slots
+       slotted = len(available_slots) > 1 or \
+               (len(available_slots) == 1 and "0" not in available_slots)
+       if not slotted:
+               # check the vdb in case this is multislot
+               available_slots = set(vardb.aux_get(cpv, ["SLOT"])[0] \
+                       for cpv in vardb.match(cp))
+               slotted = len(available_slots) > 1 or \
+                       (len(available_slots) == 1 and "0" not in available_slots)
        if slotted and arg_atom != cp:
                # If the user gave a specific atom, store it as a
                # slot atom in the world file.
@@ -3036,7 +3046,7 @@ class depgraph:
                                                favorites_set.findAtomForPackage(pkg_key, metadata):
                                                # Maybe it will be added to world now.
                                                if create_world_atom(pkg_key, metadata,
-                                                       favorites_set, root_config.sets, portdb):
+                                                       favorites_set, root_config):
                                                        pkg_world = True
                                except portage_exception.InvalidDependString:
                                        # This is reported elsewhere if relevant.
@@ -3251,7 +3261,7 @@ class depgraph:
                                self.mydbapi[root].aux_get(pkg_key, self._mydbapi_keys)))
                        try:
                                myfavkey = create_world_atom(pkg_key, metadata,
-                                       args_set, root_config.sets, portdb)
+                                       args_set, root_config)
                                if myfavkey:
                                        if myfavkey in added_favorites:
                                                continue
@@ -3494,8 +3504,9 @@ class MergeTask(object):
                                del x, mytype, myroot, mycpv, mystatus, quiet_config
                        del shown_verifying_msg, quiet_settings
 
-               system_set = SystemSet(self.settings)
-               args_set = AtomSet(favorites)
+               root_config = RootConfig(self.trees[self.target_root])
+               system_set = root_config.sets["system"]
+               args_set = root_config.sets["world"]
                world_set = WorldSet(self.settings)
                if "--resume" not in self.myopts:
                        mymergelist = mylist
@@ -3784,8 +3795,7 @@ class MergeTask(object):
                                        world_set.lock()
                                        world_set.load()
                                        myfavkey = create_world_atom(pkg_key, metadata,
-                                               args_set, {"world":world_set, "system":system_set},
-                                               portdb)
+                                               args_set, root_config)
                                        if myfavkey:
                                                world_set.add(myfavkey)
                                                print ">>> Recording",myfavkey,"in \"world\" favorites file..."