frozenset categories optimize pordbapi.cp_list()
authorZac Medico <zmedico@gentoo.org>
Sat, 15 Oct 2011 18:38:35 +0000 (11:38 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 15 Oct 2011 18:38:35 +0000 (11:38 -0700)
bin/repoman
pym/portage/package/ebuild/config.py

index 2a6d7825b2b40c5f39b4d63bc4874c5892ff0475..b80b783866a3b79fed34782787d96d0717c4e3ff 100755 (executable)
@@ -680,9 +680,9 @@ categories = []
 for path in set([portdir, repodir]):
        categories.extend(portage.util.grabfile(
                os.path.join(path, 'profiles', 'categories')))
-repoman_settings.categories = tuple(sorted(
-       portage.util.stack_lists([categories], incremental=1)))
-categories = frozenset(repoman_settings.categories)
+repoman_settings.categories = frozenset(
+       portage.util.stack_lists([categories], incremental=1))
+categories = repoman_settings.categories
 
 portdb.settings = repoman_settings
 root_config = RootConfig(repoman_settings, trees[root], None)
index 37dcbb4cf3de3136aea48a7ab474cb05522cb244..a80c82dd53d26a2db119e7747d85d69fd28b8be1 100644 (file)
@@ -606,9 +606,11 @@ class config(object):
                        self.categories = [grabfile(os.path.join(x, "categories")) \
                                for x in locations_manager.profile_and_user_locations]
                        category_re = dbapi._category_re
-                       self.categories = tuple(sorted(
+                       # categories used to be a tuple, but now we use a frozenset
+                       # for hashed category validation in pordbapi.cp_list()
+                       self.categories = frozenset(
                                x for x in stack_lists(self.categories, incremental=1)
-                               if category_re.match(x) is not None))
+                               if category_re.match(x) is not None)
 
                        archlist = [grabfile(os.path.join(x, "arch.list")) \
                                for x in locations_manager.profile_and_user_locations]