1 |
commit: b33e1b6d26f9c4df6a1b6773e5471e2caa1012b3 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 30 22:05:00 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 30 22:05:00 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b33e1b6d |
7 |
|
8 |
repos.conf: implement trust-authoritative-cache |
9 |
|
10 |
This controls whether or not the layout.conf |
11 |
"authoritative-cache = true" setting will be trusted for a particular |
12 |
repo. It can be enabled globally by setting |
13 |
"trust-authoritative-cache = true" in the [DEFAULT] section of |
14 |
repos.conf. |
15 |
|
16 |
--- |
17 |
pym/portage/repository/config.py | 24 +++++++++++++++++++++++- |
18 |
1 files changed, 23 insertions(+), 1 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
21 |
index 424b89d..846de39 100644 |
22 |
--- a/pym/portage/repository/config.py |
23 |
+++ b/pym/portage/repository/config.py |
24 |
@@ -43,7 +43,8 @@ class RepoConfig(object): |
25 |
|
26 |
__slots__ = ['aliases', 'eclass_overrides', 'eclass_locations', 'location', 'user_location', 'masters', 'main_repo', |
27 |
'missing_repo_name', 'name', 'priority', 'sync', 'format', 'sign_manifest', 'thin_manifest', |
28 |
- 'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authoritative'] |
29 |
+ 'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authoritative', |
30 |
+ 'trust_authoritative_cache'] |
31 |
|
32 |
def __init__(self, name, repo_opts): |
33 |
"""Build a RepoConfig with options in repo_opts |
34 |
@@ -119,6 +120,11 @@ class RepoConfig(object): |
35 |
self.disable_manifest = False |
36 |
self.cache_is_authoritative = False |
37 |
|
38 |
+ trust_authoritative_cache = repo_opts.get('trust-authoritative-cache') |
39 |
+ if trust_authoritative_cache is not None: |
40 |
+ trust_authoritative_cache = trust_authoritative_cache.lower() == 'true' |
41 |
+ self.trust_authoritative_cache = trust_authoritative_cache |
42 |
+ |
43 |
def load_manifest(self, *args, **kwds): |
44 |
kwds['thin'] = self.thin_manifest |
45 |
kwds['allow_missing'] = self.allow_missing_manifest |
46 |
@@ -135,6 +141,8 @@ class RepoConfig(object): |
47 |
self.eclass_overrides = new_repo.eclass_overrides |
48 |
if new_repo.masters is not None: |
49 |
self.masters = new_repo.masters |
50 |
+ if new_repo.trust_authoritative_cache is not None: |
51 |
+ self.trust_authoritative_cache = new_repo.trust_authoritative_cache |
52 |
if new_repo.name is not None: |
53 |
self.name = new_repo.name |
54 |
self.missing_repo_name = new_repo.missing_repo_name |
55 |
@@ -222,6 +230,12 @@ class RepoConfigLoader(object): |
56 |
if prepos['DEFAULT'].masters is not None: |
57 |
default_repo_opts['masters'] = \ |
58 |
' '.join(prepos['DEFAULT'].masters) |
59 |
+ if prepos['DEFAULT'].trust_authoritative_cache is not None: |
60 |
+ if prepos['DEFAULT'].trust_authoritative_cache: |
61 |
+ default_repo_opts['trust-authoritative-cache'] = 'true' |
62 |
+ else: |
63 |
+ default_repo_opts['trust-authoritative-cache'] = 'false' |
64 |
+ |
65 |
if overlays: |
66 |
#overlay priority is negative because we want them to be looked before any other repo |
67 |
base_priority = 0 |
68 |
@@ -241,6 +255,12 @@ class RepoConfigLoader(object): |
69 |
if repo_conf_opts.masters is not None: |
70 |
repo_opts['masters'] = \ |
71 |
' '.join(repo_conf_opts.masters) |
72 |
+ if repo_conf_opts.trust_authoritative_cache is not None: |
73 |
+ if repo_conf_opts.trust_authoritative_cache: |
74 |
+ repo_opts['trust-authoritative-cache'] = 'true' |
75 |
+ else: |
76 |
+ repo_opts['trust-authoritative-cache'] = 'false' |
77 |
+ |
78 |
repo = RepoConfig(repo.name, repo_opts) |
79 |
if repo.name in prepos: |
80 |
old_location = prepos[repo.name].location |
81 |
@@ -359,6 +379,8 @@ class RepoConfigLoader(object): |
82 |
repo.create_manifest = manifest_policy != 'false' |
83 |
repo.disable_manifest = manifest_policy == 'false' |
84 |
repo.cache_is_authoritative = layout_data.get('authoritative-cache', 'false').lower() == 'true' |
85 |
+ if not repo.trust_authoritative_cache: |
86 |
+ repo.cache_is_authoritative = False |
87 |
|
88 |
#Take aliases into account. |
89 |
new_prepos = {} |