Split out a depgraph method to check if a specific new-style virtual
authorZac Medico <zmedico@gentoo.org>
Wed, 9 Apr 2008 07:27:50 +0000 (07:27 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 9 Apr 2008 07:27:50 +0000 (07:27 -0000)
package exists. (trunk r9761)

svn path=/main/branches/2.1.2/; revision=9766

bin/emerge

index e4359ad130269119e2f94555e75aefd8ea545379..e14d7f283dfa3fcc924ecf026fe307a4e8ac1fd1 100755 (executable)
@@ -2150,6 +2150,15 @@ class depgraph(object):
                        return 0
                return 1
 
+       def _have_new_virt(self, root, atom_cp):
+               ret = False
+               for db, pkg_type, built, installed, db_keys in \
+                       self._filtered_trees[root]["dbs"]:
+                       if db.cp_list(atom_cp):
+                               ret = True
+                               break
+               return ret
+
        def _iter_atoms_for_pkg(self, pkg):
                # TODO: add multiple $ROOT support
                if pkg.root != self.target_root:
@@ -2157,15 +2166,9 @@ class depgraph(object):
                atom_arg_map = self._atom_arg_map
                for atom in self._set_atoms.iterAtomsForPackage(pkg):
                        atom_cp = portage.dep_getkey(atom)
-                       if atom_cp != pkg.cp:
-                               have_new_virt = False
-                               for db, pkg_type, built, installed, db_keys in \
-                                       self._filtered_trees[pkg.root]["dbs"]:
-                                       if db.cp_list(atom_cp):
-                                               have_new_virt = True
-                                               break
-                               if have_new_virt:
-                                       continue
+                       if atom_cp != pkg.cp and \
+                               self._have_new_virt(pkg.root, atom_cp):
+                               continue
                        for arg in atom_arg_map[(atom, pkg.root)]:
                                if isinstance(arg, PackageArg) and \
                                        arg.package != pkg: