dep_check_composite_db: implement cp_list
authorZac Medico <zmedico@gentoo.org>
Mon, 9 May 2011 22:34:06 +0000 (15:34 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 12 May 2011 05:10:05 +0000 (22:10 -0700)
This is used by dep_check since commit
6f9ee9c508c1506cdf8eb0dc46796dbe30f268db.

pym/_emerge/depgraph.py

index 0c36e3a3120d86be03da677db5954902215d2803..acf941e5bfa35a17fb8bb6261647074e68486c05 100644 (file)
@@ -5672,6 +5672,23 @@ class _dep_check_composite_db(dbapi):
                self._match_cache.clear()
                self._cpv_pkg_map.clear()
 
+       def cp_list(self, cp):
+               """
+               Emulate cp_list just so it can be used to check for existence
+               of new-style virtuals.
+               """
+               if isinstance(cp, Atom):
+                       atom = cp
+               else:
+                       atom = Atom(cp)
+               ret = []
+               for pkg in self._depgraph._iter_match_pkgs_any(
+                       self._depgraph._frozen_config.roots[self._root], atom):
+                       if pkg.cp == cp:
+                               ret.append(pkg.cpv)
+
+               return ret
+
        def match(self, atom):
                ret = self._match_cache.get(atom)
                if ret is not None: