1 |
commit: e626628a338aa90f9cf321ec89789da72f67a9e0 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 28 07:13:41 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 28 07:13:41 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e626628a |
7 |
|
8 |
RepoConfig.update(): copy more attributes |
9 |
|
10 |
This fixes a regression since commit |
11 |
10246cd535f909dda8bd05de617c32d2b8a56b4a which caused layout.conf |
12 |
settings such as thin-manifests to be ignored for repositories that |
13 |
had repos.conf settings that did not specify the repository location. |
14 |
In order to trigger this case, ResolverPlayground has been modified to |
15 |
omit the location of each repository in the repos.conf file that it |
16 |
generates. |
17 |
|
18 |
--- |
19 |
pym/portage/repository/config.py | 13 ++++++++++--- |
20 |
pym/portage/tests/ebuild/test_config.py | 2 ++ |
21 |
pym/portage/tests/resolver/ResolverPlayground.py | 10 +++------- |
22 |
3 files changed, 15 insertions(+), 10 deletions(-) |
23 |
|
24 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
25 |
index f98b9b7..4bf995e 100644 |
26 |
--- a/pym/portage/repository/config.py |
27 |
+++ b/pym/portage/repository/config.py |
28 |
@@ -199,8 +199,9 @@ class RepoConfig(object): |
29 |
def update(self, new_repo): |
30 |
"""Update repository with options in another RepoConfig""" |
31 |
|
32 |
- for k in ('aliases', 'eclass_overrides', 'location', 'masters', |
33 |
- 'name', 'priority', 'sync', 'user_location'): |
34 |
+ keys = set(self.__slots__) |
35 |
+ keys.discard("missing_repo_name") |
36 |
+ for k in keys: |
37 |
v = getattr(new_repo, k, None) |
38 |
if v is not None: |
39 |
setattr(self, k, v) |
40 |
@@ -324,7 +325,13 @@ class RepoConfigLoader(object): |
41 |
repo_opts = default_repo_opts.copy() |
42 |
repo_opts['location'] = ov |
43 |
repo = RepoConfig(None, repo_opts) |
44 |
- # repos_conf_opts contains options from /etc/portage/repos.conf |
45 |
+ # repos_conf_opts may contain options from various places: |
46 |
+ # 1) /etc/portage/repos.conf |
47 |
+ # 2) $location/metadata/layout.conf if repos.conf specified |
48 |
+ # the repo location |
49 |
+ # 3) A RepoConfig instance corresponding to a previously |
50 |
+ # processed path in the current list of overlays which |
51 |
+ # referred to a repository with the same name. |
52 |
repos_conf_opts = prepos.get(repo.name) |
53 |
if repos_conf_opts is not None: |
54 |
if repos_conf_opts.aliases is not None: |
55 |
|
56 |
diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py |
57 |
index 570cb2b..35694ed 100644 |
58 |
--- a/pym/portage/tests/ebuild/test_config.py |
59 |
+++ b/pym/portage/tests/ebuild/test_config.py |
60 |
@@ -243,6 +243,8 @@ class ConfigTestCase(TestCase): |
61 |
self.assertTrue(len(new_repo_config.masters) > 0, "new_repo has no default master") |
62 |
self.assertEqual(new_repo_config.masters[0].user_location, playground.portdir, |
63 |
"new_repo default master is not PORTDIR") |
64 |
+ self.assertEqual(new_repo_config.thin_manifest, True, |
65 |
+ "new_repo_config.thin_manifest != True") |
66 |
|
67 |
new_manifest_file = os.path.join(playground.repo_dirs["new_repo"], "dev-libs", "A", "Manifest") |
68 |
self.assertEqual(os.path.exists(new_manifest_file), False) |
69 |
|
70 |
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py |
71 |
index 201c5c4..140b25d 100644 |
72 |
--- a/pym/portage/tests/resolver/ResolverPlayground.py |
73 |
+++ b/pym/portage/tests/resolver/ResolverPlayground.py |
74 |
@@ -376,17 +376,13 @@ class ResolverPlayground(object): |
75 |
with open(os.path.join(metadata_dir, "metadata.xml"), 'w') as f: |
76 |
f.write(herds_xml) |
77 |
|
78 |
+ # Write empty entries for each repository, in order to exercise |
79 |
+ # RepoConfigLoader's repos.conf processing. |
80 |
repos_conf_file = os.path.join(user_config_dir, "repos.conf") |
81 |
f = open(repos_conf_file, "w") |
82 |
- priority = 0 |
83 |
for repo in sorted(self.repo_dirs.keys()): |
84 |
f.write("[%s]\n" % repo) |
85 |
- f.write("LOCATION=%s\n" % self.repo_dirs[repo]) |
86 |
- if repo == "test_repo": |
87 |
- f.write("PRIORITY=%s\n" % -1000) |
88 |
- else: |
89 |
- f.write("PRIORITY=%s\n" % priority) |
90 |
- priority += 1 |
91 |
+ f.write("\n") |
92 |
f.close() |
93 |
|
94 |
for config_file, lines in user_config.items(): |