Add an optional 'categories' parameter to portdbapi.cp_all(), for listing
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:07:56 +0000 (20:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:07:56 +0000 (20:07 -0000)
a subset of categories. Thanks to dol-sen for the suggestion. (trunk r15323)

svn path=/main/branches/2.1.7/; revision=15556

pym/portage/dbapi/porttree.py

index 4cf7d410d1e02beacd7fee91254983c075ed1e9a..cf7eeac7f01b889b925b7f92c95ccbbbdfc0f64c 100644 (file)
@@ -889,10 +889,12 @@ class portdbapi(dbapi):
                else:
                        return 0
 
-       def cp_all(self):
+       def cp_all(self, categories=None):
                "returns a list of all keys in our tree"
                d = {}
-               for x in self.settings.categories:
+               if categories is None:
+                       categories = self.settings.categories
+               for x in categories:
                        for oroot in self.porttrees:
                                for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1):
                                        if not self._pkg_dir_name_re.match(y) or \