diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-09-30 15:05:00 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-09-30 15:05:00 -0700 |
commit | b33e1b6d26f9c4df6a1b6773e5471e2caa1012b3 (patch) | |
tree | 430f993a5536bef2b94a6d9d95123061f0dc7bbd | |
parent | ed3b2b43aa329d007f7bb0eb303b3f74e927970a (diff) | |
download | portage-b33e1b6d26f9c4df6a1b6773e5471e2caa1012b3.tar.gz portage-b33e1b6d26f9c4df6a1b6773e5471e2caa1012b3.tar.bz2 portage-b33e1b6d26f9c4df6a1b6773e5471e2caa1012b3.zip |
repos.conf: implement trust-authoritative-cache
This controls whether or not the layout.conf
"authoritative-cache = true" setting will be trusted for a particular
repo. It can be enabled globally by setting
"trust-authoritative-cache = true" in the [DEFAULT] section of
repos.conf.
-rw-r--r-- | pym/portage/repository/config.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 424b89db2..846de3908 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -43,7 +43,8 @@ class RepoConfig(object): __slots__ = ['aliases', 'eclass_overrides', 'eclass_locations', 'location', 'user_location', 'masters', 'main_repo', 'missing_repo_name', 'name', 'priority', 'sync', 'format', 'sign_manifest', 'thin_manifest', - 'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authoritative'] + 'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authoritative', + 'trust_authoritative_cache'] def __init__(self, name, repo_opts): """Build a RepoConfig with options in repo_opts @@ -119,6 +120,11 @@ class RepoConfig(object): self.disable_manifest = False self.cache_is_authoritative = False + trust_authoritative_cache = repo_opts.get('trust-authoritative-cache') + if trust_authoritative_cache is not None: + trust_authoritative_cache = trust_authoritative_cache.lower() == 'true' + self.trust_authoritative_cache = trust_authoritative_cache + def load_manifest(self, *args, **kwds): kwds['thin'] = self.thin_manifest kwds['allow_missing'] = self.allow_missing_manifest @@ -135,6 +141,8 @@ class RepoConfig(object): self.eclass_overrides = new_repo.eclass_overrides if new_repo.masters is not None: self.masters = new_repo.masters + if new_repo.trust_authoritative_cache is not None: + self.trust_authoritative_cache = new_repo.trust_authoritative_cache if new_repo.name is not None: self.name = new_repo.name self.missing_repo_name = new_repo.missing_repo_name @@ -222,6 +230,12 @@ class RepoConfigLoader(object): if prepos['DEFAULT'].masters is not None: default_repo_opts['masters'] = \ ' '.join(prepos['DEFAULT'].masters) + if prepos['DEFAULT'].trust_authoritative_cache is not None: + if prepos['DEFAULT'].trust_authoritative_cache: + default_repo_opts['trust-authoritative-cache'] = 'true' + else: + default_repo_opts['trust-authoritative-cache'] = 'false' + if overlays: #overlay priority is negative because we want them to be looked before any other repo base_priority = 0 @@ -241,6 +255,12 @@ class RepoConfigLoader(object): if repo_conf_opts.masters is not None: repo_opts['masters'] = \ ' '.join(repo_conf_opts.masters) + if repo_conf_opts.trust_authoritative_cache is not None: + if repo_conf_opts.trust_authoritative_cache: + repo_opts['trust-authoritative-cache'] = 'true' + else: + repo_opts['trust-authoritative-cache'] = 'false' + repo = RepoConfig(repo.name, repo_opts) if repo.name in prepos: old_location = prepos[repo.name].location @@ -359,6 +379,8 @@ class RepoConfigLoader(object): repo.create_manifest = manifest_policy != 'false' repo.disable_manifest = manifest_policy == 'false' repo.cache_is_authoritative = layout_data.get('authoritative-cache', 'false').lower() == 'true' + if not repo.trust_authoritative_cache: + repo.cache_is_authoritative = False #Take aliases into account. new_prepos = {} |