diff options
author | Michał Górny <mgorny@gentoo.org> | 2010-10-29 21:32:48 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-11-19 04:51:07 -0800 |
commit | f9b67bd8385b344b9a29a46bf2f3c7e2def020c4 (patch) | |
tree | c24a6e5964883e2d10cc8bb0344bbca7011908ef /pym/portage | |
parent | c324593f675306f6d38060ac7da654750de2a28f (diff) | |
download | portage-f9b67bd8385b344b9a29a46bf2f3c7e2def020c4.tar.gz portage-f9b67bd8385b344b9a29a46bf2f3c7e2def020c4.tar.bz2 portage-f9b67bd8385b344b9a29a46bf2f3c7e2def020c4.zip |
Cache package.mask files within MaskManager.
As a single repository may be often referenced by others as a 'master',
it is really useful to keep a cache of already-read package.mask files.
Especially if that repo has a large package.mask file like gx86 does.
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/package/ebuild/_config/MaskManager.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py index ef72aeb8f..25d679e9f 100644 --- a/pym/portage/package/ebuild/_config/MaskManager.py +++ b/pym/portage/package/ebuild/_config/MaskManager.py @@ -24,14 +24,23 @@ class MaskManager(object): #Add ::repo specs to every atom to make sure atoms only affect #packages from the current repo. + # Cache the repository-wide package.mask files as a particular + # repo may be often referenced by others as the master. + pmask_cache = {} + + def grab_pmask(loc): + if loc not in pmask_cache: + pmask_cache[loc] = grabfile_package( + os.path.join(loc, "profiles", "package.mask"), + recursive=1, remember_source_file=True, verify_eapi=True) + return pmask_cache[loc] + repo_pkgmasklines = [] for repo in repositories.repos_with_profiles(): lines = [] - repo_lines = grabfile_package(os.path.join(repo.location, "profiles", "package.mask"), \ - recursive=1, remember_source_file=True, verify_eapi=True) + repo_lines = grab_pmask(repo.location) for master in repo.masters: - master_lines = grabfile_package(os.path.join(master.location, "profiles", "package.mask"), \ - recursive=1, remember_source_file=True, verify_eapi=True) + master_lines = grab_pmask(master.location) lines.append(stack_lists([master_lines, repo_lines], incremental=1, remember_source_file=True, warn_for_unmatched_removal=True, strict_warn_for_unmatched_removal=strict_umatched_removal)) |