From 91b76333c00c38c1b08c9e6ec1c3500d01f85aae Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 4 Oct 2008 05:09:23 +0000 Subject: [PATCH] Make depgraph._add_pkg() take a Dependency instance. This provides access to the atom which pulled in the package, which may be needed in order to verify that a different package that's been added to the graph is capable of satisfying the atom. svn path=/main/trunk/; revision=11617 --- pym/_emerge/__init__.py | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 8d4027df6..5139c3c43 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -4431,12 +4431,20 @@ class depgraph(object): self._ignored_deps.append(dep) return 1 - if not self._add_pkg(dep_pkg, dep.parent, - priority=dep.priority, depth=dep.depth): + if not self._add_pkg(dep_pkg, dep): return 0 return 1 - def _add_pkg(self, pkg, myparent, priority=None, depth=0): + def _add_pkg(self, pkg, dep): + myparent = None + priority = None + depth = 0 + if dep is None: + dep = Dependency() + else: + myparent = dep.parent + priority = dep.priority + depth = dep.depth if priority is None: priority = DepPriority() """ @@ -5029,6 +5037,8 @@ class depgraph(object): arg = args.pop() for atom in arg.set: self.spinner.update() + dep = Dependency(atom=atom, onlydeps=onlydeps, + root=myroot, parent=arg) atom_cp = portage.dep_getkey(atom) try: pprovided = pprovideddict.get(portage.dep_getkey(atom)) @@ -5037,7 +5047,7 @@ class depgraph(object): self._pprovided_args.append((arg, atom)) continue if isinstance(arg, PackageArg): - if not self._add_pkg(arg.package, arg) or \ + if not self._add_pkg(arg.package, dep) or \ not self._create_graph(): sys.stderr.write(("\n\n!!! Problem resolving " + \ "dependencies for %s\n") % arg.arg) @@ -5080,14 +5090,10 @@ class depgraph(object): arg.name in ("system", "world")): return 0, myfavorites - dep = Dependency(atom=atom, onlydeps=onlydeps, - root=myroot, parent=arg) - # Add the selected package to the graph as soon as possible # so that later dep_check() calls can use it as feedback # for making more consistent atom selections. - if not self._add_pkg(pkg, dep.parent, - priority=dep.priority, depth=dep.depth): + if not self._add_pkg(pkg, dep): if isinstance(arg, SetArg): sys.stderr.write(("\n\n!!! Problem resolving " + \ "dependencies for %s from %s\n") % \ @@ -5696,8 +5702,7 @@ class depgraph(object): # will be appropriately reported as a slot collision # (possibly solvable via backtracking). pkg = matches[-1] # highest match - if not self._add_pkg(pkg, dep.parent, - priority=dep.priority, depth=dep.depth): + if not self._add_pkg(pkg, dep): return 0 if not self._create_graph(allow_unsatisfied=True): return 0 @@ -7741,7 +7746,8 @@ class depgraph(object): arg.root_config.root, atom) if existing_node is None and \ pkg is not None: - if not self._add_pkg(pkg, arg): + if not self._add_pkg(pkg, Dependency(atom=atom, + root=pkg.root, parent=arg)): return False # Allow unsatisfied deps here to avoid showing a masking @@ -12401,8 +12407,9 @@ def action_depclean(settings, trees, ldpath_mtimes, for consumer_dblink in set(chain(*consumers.values())): consumer_pkg = vardb.get(("installed", myroot, consumer_dblink.mycpv, "nomerge")) - resolver._add_pkg(pkg, consumer_pkg, - priority=UnmergeDepPriority(runtime=True)) + resolver._add_pkg(pkg, Dependency(parent=consumer_pkg, + priority=UnmergeDepPriority(runtime=True), + root=pkg.root)) writemsg_level("\nCalculating dependencies ") success = resolver._complete_graph() -- 2.26.2