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
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.
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.
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
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
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..."