Fix depgraph._add_pkg() to ensure that the existing package in the graph
authorZac Medico <zmedico@gentoo.org>
Sat, 4 Oct 2008 05:40:27 +0000 (05:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 4 Oct 2008 05:40:27 +0000 (05:40 -0000)
matches the required atom in cases when a different package has been
passed in. This solves a problem with silently unsatisfied USE deps that
was reported by Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>. Now the
unsatisfied dependency will result in a "slot conflict" rather than be
silently ignored.

svn path=/main/trunk/; revision=11618

pym/_emerge/__init__.py

index 5139c3c43ffc8cdb1072aa06fb48e691851d83ce..96f3c2aa98519cc133c8aae1052dba3912e802e3 100644 (file)
@@ -4494,7 +4494,16 @@ class depgraph(object):
                        existing_node = self._slot_pkg_map[pkg.root].get(pkg.slot_atom)
                        slot_collision = False
                        if existing_node:
-                               if pkg.cpv == existing_node.cpv:
+                               existing_node_matches = pkg.cpv == existing_node.cpv
+                               if existing_node_matches and \
+                                       pkg != existing_node and \
+                                       dep.atom is not None:
+                                       # Use package set for matching since it will match via
+                                       # PROVIDE when necessary, while match_from_list does not.
+                                       atom_set = InternalPackageSet(initial_atoms=[dep.atom])
+                                       if not atom_set.findAtomForPackage(existing_node):
+                                               existing_node_matches = False
+                               if existing_node_matches:
                                        # The existing node can be reused.
                                        if args:
                                                for arg in args: