From 860cd660895829d6915e3dc9643f78e2f12bf3da Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 22 Oct 2007 18:49:02 +0000 Subject: In depgraph.create(), don't ignore direct circular dependencies anymore since altlist() is able to handle it properly in cases where the dependency is satisfied. If the dep is unsatisfied then it can not be ignored. (trunk r8225) Allow the depgraph to add old-style virtual providers but prefer any pre-existing providers over new ones that are added. This prevents things like ghc-6.4.2 from selecting itself to satisfy it's own virtual/ghc dependency (creating a circular dependency) in cases where it should select the default ghc-bin provider. (trunk r8185:8187) svn path=/main/branches/2.1.2/; revision=8229 --- bin/emerge | 59 +++++++++++++++++++++++------------------------------------ 1 file changed, 23 insertions(+), 36 deletions(-) (limited to 'bin') diff --git a/bin/emerge b/bin/emerge index 6ce75d5c5..3ce12f1d6 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1350,14 +1350,13 @@ class depgraph: if existing_node: e_type, myroot, e_cpv, e_status = existing_node if mykey == e_cpv: - # The existing node can be reused. - if existing_node != myparent: - # Refuse to make a node depend on itself so that - # we don't create a bogus circular dependency - # in self.altlist(). - self._parent_child_digraph.add(existing_node, myparent) - self.digraph.addnode(existing_node, myparent, - priority=priority) + # The existing node can be reused. It's okay for a + # node to depend on itself here if priority.satisfied + # is True, otherwise it is a circular dependency that + # can not be ignored. + self._parent_child_digraph.add(existing_node, myparent) + self.digraph.addnode(existing_node, myparent, + priority=priority) return 1 else: if jbigkey in self._slot_collision_nodes: @@ -1401,6 +1400,22 @@ class depgraph: self.digraph.addnode(jbigkey, myparent, priority=priority) + if mytype != "installed": + # Allow this package to satisfy old-style virtuals in case it + # doesn't already. Any pre-existing providers will be preferred + # over this one. + try: + pkgsettings.setinst(mykey, metadata) + # For consistency, also update the global virtuals. + settings = self.roots[myroot].settings + settings.unlock() + settings.setinst(mykey, metadata) + settings.lock() + except portage.exception.InvalidDependString, e: + show_invalid_depstring_notice(jbigkey, metadata["PROVIDE"], str(e)) + del e + return 0 + if arg: self._set_nodes.add(jbigkey) @@ -1770,34 +1785,6 @@ class depgraph: if depstring in self._set_atoms: self._pprovided_args.append((arg, depstring)) - if myparent: - # The parent is added after it's own dep_check call so that it - # isn't allowed to satisfy a direct bootstrap dependency on itself - # via an old-style virtual. This isn't a problem with new-style - # virtuals, which are preferenced in dep_zapdeps by looking only at - # the depstring, vdb, and available packages. - - p_type, p_root, p_key, p_status = myparent - if p_status == "merge": - # Update old-style virtuals if this package provides any. - # These are needed for dep_virtual calls inside dep_check. - p_db = self.mydbapi[p_root] # contains cached metadata - if myparent in self._slot_collision_nodes: - # The metadata isn't cached due to the slot collision. - p_db = self.trees[p_root][self.pkg_tree_map[p_type]].dbapi - try: - self.pkgsettings[p_root].setinst(p_key, p_db) - # For consistency, also update the global virtuals. - settings = self.roots[p_root].settings - settings.unlock() - settings.setinst(p_key, p_db) - settings.lock() - except portage_exception.InvalidDependString, e: - provide = p_db.aux_get(p_key, ["PROVIDE"])[0] - show_invalid_depstring_notice(myparent, provide, str(e)) - del e - return 0 - if "--debug" in self.myopts: print "Candidates:",mymerge for x in mymerge: -- cgit v1.2.3-1-g7c22