Inside depgraph.validate_blockers(), prevent false positives in PROVIDE
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 06:48:06 +0000 (06:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 06:48:06 +0000 (06:48 -0000)
virtual blocker matches that can occur for packages for packages that don't
actual have the appropriate value in PROVIDE (triggered by profile 'virtuals'
settings). Thanks to Ned Ludd <solar@g.o> for reporting. (trunk r13248)

svn path=/main/branches/2.1.6/; revision=13427

pym/_emerge/__init__.py

index 75f3724c4beee6bfcfdb29c0660e261b630018ee..5cf360ec073a7aead7edaf0eb5b19aaf41468459 100644 (file)
@@ -6738,10 +6738,15 @@ class depgraph(object):
                        final_db = self.mydbapi[myroot]
                        
                        provider_virtual = False
-                       if blocker.cp in virtuals and \
+                       if blocker.cp.startswith('virtual/') and \
                                not self._have_new_virt(blocker.root, blocker.cp):
                                provider_virtual = True
 
+                       # Use this to check PROVIDE for each matched package
+                       # when necessary.
+                       atom_set = InternalPackageSet(
+                               initial_atoms=[blocker.atom])
+
                        if provider_virtual:
                                atoms = []
                                for provider_entry in virtuals[blocker.cp]:
@@ -6752,13 +6757,17 @@ class depgraph(object):
                        else:
                                atoms = [blocker.atom]
 
-                       blocked_initial = []
+                       blocked_initial = set()
                        for atom in atoms:
-                               blocked_initial.extend(initial_db.match_pkgs(atom))
+                               for pkg in initial_db.match_pkgs(atom):
+                                       if atom_set.findAtomForPackage(pkg):
+                                               blocked_initial.add(pkg)
 
-                       blocked_final = []
+                       blocked_final = set()
                        for atom in atoms:
-                               blocked_final.extend(final_db.match_pkgs(atom))
+                               for pkg in final_db.match_pkgs(atom):
+                                       if atom_set.findAtomForPackage(pkg):
+                                               blocked_final.add(pkg)
 
                        if not blocked_initial and not blocked_final:
                                parent_pkgs = self._blocker_parents.parent_nodes(blocker)