1 |
commit: e2f5b48cd9533eea83b02c97cbab9e0df86e78e8 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 28 08:15:58 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 28 08:15:58 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e2f5b48c |
7 |
|
8 |
RepoConfigLoader: don't mix duplicate repo config |
9 |
|
10 |
RepoConfig.update() was being used to copy attributes from one instance |
11 |
to another, possibly leading to inappropriate mixing of layout.conf |
12 |
attributes from separate copies of the same repo. This is common with |
13 |
repoman, for example, when temporarily overriding an rsync repo with |
14 |
another copy of the same repo from CVS. |
15 |
|
16 |
--- |
17 |
pym/portage/repository/config.py | 35 +++++++++++++++++------------------ |
18 |
1 files changed, 17 insertions(+), 18 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
21 |
index 4bf995e..1db691b 100644 |
22 |
--- a/pym/portage/repository/config.py |
23 |
+++ b/pym/portage/repository/config.py |
24 |
@@ -318,6 +318,14 @@ class RepoConfigLoader(object): |
25 |
' '.join(prepos['DEFAULT'].masters) |
26 |
|
27 |
if overlays: |
28 |
+ # We need a copy of the original repos.conf data, since we're |
29 |
+ # going to modify the prepos dict and some of the RepoConfig |
30 |
+ # objects that we put in prepos may have to be discarded if |
31 |
+ # they get overridden by a repository with the same name but |
32 |
+ # a different location. This is common with repoman, for example, |
33 |
+ # when temporarily overriding an rsync repo with another copy |
34 |
+ # of the same repo from CVS. |
35 |
+ repos_conf = prepos.copy() |
36 |
#overlay priority is negative because we want them to be looked before any other repo |
37 |
base_priority = 0 |
38 |
for ov in overlays: |
39 |
@@ -325,21 +333,15 @@ class RepoConfigLoader(object): |
40 |
repo_opts = default_repo_opts.copy() |
41 |
repo_opts['location'] = ov |
42 |
repo = RepoConfig(None, repo_opts) |
43 |
- # repos_conf_opts may contain options from various places: |
44 |
- # 1) /etc/portage/repos.conf |
45 |
- # 2) $location/metadata/layout.conf if repos.conf specified |
46 |
- # the repo location |
47 |
- # 3) A RepoConfig instance corresponding to a previously |
48 |
- # processed path in the current list of overlays which |
49 |
- # referred to a repository with the same name. |
50 |
- repos_conf_opts = prepos.get(repo.name) |
51 |
+ # repos_conf_opts contains options from repos.conf |
52 |
+ repos_conf_opts = repos_conf.get(repo.name) |
53 |
if repos_conf_opts is not None: |
54 |
- if repos_conf_opts.aliases is not None: |
55 |
- repo.aliases = repos_conf_opts.aliases |
56 |
- if repos_conf_opts.eclass_overrides is not None: |
57 |
- repo.eclass_overrides = repos_conf_opts.eclass_overrides |
58 |
- if repos_conf_opts.masters is not None: |
59 |
- repo.masters = repos_conf_opts.masters |
60 |
+ # Selectively copy only the attributes which |
61 |
+ # repos.conf is allowed to override. |
62 |
+ for k in ('aliases', 'eclass_overrides', 'masters'): |
63 |
+ v = getattr(repos_conf_opts, k, None) |
64 |
+ if v is not None: |
65 |
+ setattr(repo, k, v) |
66 |
|
67 |
if repo.name in prepos: |
68 |
old_location = prepos[repo.name].location |
69 |
@@ -348,10 +350,6 @@ class RepoConfigLoader(object): |
70 |
ignored_location_map[old_location] = repo.name |
71 |
if old_location == portdir: |
72 |
portdir = repo.user_location |
73 |
- prepos[repo.name].update(repo) |
74 |
- repo = prepos[repo.name] |
75 |
- else: |
76 |
- prepos[repo.name] = repo |
77 |
|
78 |
if ov == portdir and portdir not in port_ov: |
79 |
repo.priority = -1000 |
80 |
@@ -359,6 +357,7 @@ class RepoConfigLoader(object): |
81 |
repo.priority = base_priority |
82 |
base_priority += 1 |
83 |
|
84 |
+ prepos[repo.name] = repo |
85 |
else: |
86 |
writemsg(_("!!! Invalid PORTDIR_OVERLAY" |
87 |
" (not a dir): '%s'\n") % ov, noiselevel=-1) |