f.add_flowing_data(x)
f.end_paragraph(1)
+class CompositeDbapi(object):
+ def __init__(self, depgraph, root):
+ self._depgraph = depgraph
+ self._root = root
+ self._match_cache = {}
+ self._cpv_tree_map = {}
+
+ def match(self, atom):
+ ret = self._match_cache.get(atom)
+ if ret is not None:
+ return ret[:]
+ pkg, existing = self._depgraph._select_package(self._root, atom)
+ if not pkg:
+ ret = []
+ else:
+ if pkg.installed and "selective" not in self._depgraph.myparams:
+ try:
+ if self._depgraph._set_atoms.findAtomForPackage(
+ pkg.cpv, pkg.metadata):
+ ret = []
+ except portage_exception.InvalidDependString:
+ pass
+ if ret is None:
+ self._cpv_tree_map[pkg.cpv] = \
+ self._depgraph.pkg_tree_map[pkg.type_name]
+ ret = [pkg.cpv]
+ self._match_cache[atom] = ret
+ return ret[:]
+
+ def aux_get(self, cpv, wants):
+ return self._depgraph.trees[self._root][
+ self._cpv_tree_map[cpv]].dbapi.aux_get(cpv, wants)
+
class depgraph:
pkg_tree_map = {
vardb.aux_get(pkg, self._mydbapi_keys))))
del vardb, fakedb
self._filtered_trees[myroot] = {}
+ self._filtered_trees[myroot]["vartree"] = self.trees[myroot]["vartree"]
+ def filtered_tree():
+ pass
+ filtered_tree.dbapi = CompositeDbapi(self, myroot)
+ self._filtered_trees[myroot]["porttree"] = filtered_tree
dbs = []
portdb = self.trees[myroot]["porttree"].dbapi
bindb = self.trees[myroot]["bintree"].dbapi
self._unsatisfied_deps_for_display = []
self._world_problems = False
self._select_package = self._select_pkg_highest_available
+ self._highest_pkg_cache = {}
def _show_slot_collision_notice(self):
"""Show an informational message advising the user to mask one of the
print
def _select_pkg_highest_available(self, root, atom, onlydeps=False):
+ cache_key = (root, atom, onlydeps)
+ ret = self._highest_pkg_cache.get(cache_key)
+ if ret is not None:
+ pkg, existing = ret
+ if pkg and not existing:
+ existing = self._slot_pkg_map[root].get(pkg.slot_atom)
+ if existing and existing == pkg:
+ # Update the cache to reflect that the
+ # package has been added to the graph.
+ ret = pkg, pkg
+ self._highest_pkg_cache[cache_key] = ret
+ return ret
+ ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps)
+ self._highest_pkg_cache[cache_key] = ret
+ return ret
+
+ def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False):
pkgsettings = self.pkgsettings[root]
dbs = self._filtered_trees[root]["dbs"]
vardb = self.roots[root].trees["vartree"].dbapi
mymerge = []
else:
try:
- self.trees[myroot]["selective"] = "selective" in self.myparams
if myparent and p_status == "nomerge":
portage_dep._dep_check_strict = False
mycheck = portage.dep_check(depstring, None,
- pkgsettings, myuse=myuse,
- use_binaries=("--usepkgonly" in self.myopts),
- myroot=myroot, trees=self.trees)
+ pkgsettings, myuse=myuse, myroot=myroot,
+ trees=self._filtered_trees)
finally:
- self.trees[myroot]["selective"] = False
portage_dep._dep_check_strict = True
if not mycheck[0]:
if trees is None:
global db
trees = db
- selective = trees[myroot].get("selective", False)
writemsg("ZapDeps -- %s\n" % (use_binaries), 2)
if not reduced or unreduced == ["||"] or dep_eval(reduced):
return []
avail_pkg = avail_pkg[-1] # highest (ascending order)
avail_slot = "%s:%s" % (dep_getkey(atom),
mydbapi.aux_get(avail_pkg, ["SLOT"])[0])
- elif not avail_pkg:
- if selective:
- avail_pkg = vardb.match(atom)
- if avail_pkg:
- avail_pkg = avail_pkg[-1] # highest (ascending order)
- avail_slot = "%s:%s" % (dep_getkey(atom),
- vardb.aux_get(avail_pkg, ["SLOT"])[0])
if not avail_pkg:
all_available = False
break