dep_check_composite_db: return early from cp_list
authorZac Medico <zmedico@gentoo.org>
Wed, 11 May 2011 04:03:02 +0000 (21:03 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 May 2011 05:21:58 +0000 (22:21 -0700)
Since this implementation is only intended to check for existence of
new-style virtuals, it's a waste of time to return more than one cpv.

pym/_emerge/depgraph.py

index 30085a57feb05c7000b6b2277b966cf01dcc5d37..344dcd965132a148774254ab3c8db713a1ad1185 100644 (file)
@@ -5667,7 +5667,9 @@ class _dep_check_composite_db(dbapi):
        def cp_list(self, cp):
                """
                Emulate cp_list just so it can be used to check for existence
-               of new-style virtuals.
+               of new-style virtuals. Since it's a waste of time to return
+               more than one cpv for this use case, a maximum of one cpv will
+               be returned.
                """
                if isinstance(cp, Atom):
                        atom = cp
@@ -5678,6 +5680,7 @@ class _dep_check_composite_db(dbapi):
                        self._depgraph._frozen_config.roots[self._root], atom):
                        if pkg.cp == cp:
                                ret.append(pkg.cpv)
+                               break
 
                return ret