From f4807e05962845c17d689b8bb80a1f55b85834c9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 15 Oct 2011 11:38:35 -0700 Subject: [PATCH] frozenset categories optimize pordbapi.cp_list() --- bin/repoman | 6 +++--- pym/portage/package/ebuild/config.py | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/repoman b/bin/repoman index 2a6d7825b..b80b78386 100755 --- a/bin/repoman +++ b/bin/repoman @@ -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) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 37dcbb4cf..a80c82dd5 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -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] -- 2.26.2