1 |
commit: 26971672ca3b79d512ad3a88027486a8053b7e17 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 9 22:35:09 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Sun Feb 9 22:35:09 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=26971672 |
7 |
|
8 |
Revert "Add support for the following attributes in layout.conf to allow more" |
9 |
|
10 |
This reverts commit 4c409a049c394389b1de398db511380e2fed0437. |
11 |
This needs to be submitted for review and approval. |
12 |
|
13 |
--- |
14 |
man/portage.5 | 76 ++----------- |
15 |
pym/portage/package/ebuild/_config/MaskManager.py | 10 +- |
16 |
pym/portage/package/ebuild/_config/UseManager.py | 23 ++-- |
17 |
pym/portage/package/ebuild/getmaskingreason.py | 8 +- |
18 |
pym/portage/repository/config.py | 130 ++++++++++------------ |
19 |
5 files changed, 81 insertions(+), 166 deletions(-) |
20 |
|
21 |
diff --git a/man/portage.5 b/man/portage.5 |
22 |
index 5090529..0aac569 100644 |
23 |
--- a/man/portage.5 |
24 |
+++ b/man/portage.5 |
25 |
@@ -800,9 +800,7 @@ since operations performed by these tools are inherently |
26 |
Specifies names of attributes, which should be forcefully respected by |
27 |
\fBegencache\fR(1), \fBemirrordist\fR(1) and \fBrepoman\fR(1). |
28 |
.br |
29 |
-Valid values: aliases, eclass\-masters, eclass\-overrides, masters, |
30 |
-package.mask\-masters, use.aliases\-masters, use.force\-masters, |
31 |
-use.mask\-masters |
32 |
+Valid values: aliases, eclass\-overrides, masters |
33 |
.RE |
34 |
|
35 |
.I Attributes supported in sections of repositories: |
36 |
@@ -836,24 +834,21 @@ since operations performed by these tools are inherently |
37 |
Specifies names of attributes, which should be forcefully respected by |
38 |
\fBegencache\fR(1), \fBemirrordist\fR(1) and \fBrepoman\fR(1). |
39 |
.br |
40 |
-Valid values: aliases, eclass\-masters, eclass\-overrides, masters, |
41 |
-package.mask\-masters, use.aliases\-masters, use.force\-masters, |
42 |
-use.mask\-masters |
43 |
+Valid values: aliases, eclass\-overrides, masters |
44 |
.TP |
45 |
.B location |
46 |
Specifies location of given repository. |
47 |
.TP |
48 |
-.B masters, eclass\-masters, package.mask\-masters, use.aliases\-masters, use.force\-masters, use.mask\-masters |
49 |
-Specifies master repositories of given repository. See documentation of |
50 |
-\fBlayout.conf\fR file for more details. |
51 |
+.B masters |
52 |
+Specifies master repositories of given repository. |
53 |
.br |
54 |
-Setting these attribute is generally not recommended since resulting changes |
55 |
+Setting this attribute is generally not recommended since resulting changes |
56 |
in eclass inheritance may trigger performance issues due to invalidation |
57 |
of metadata cache. |
58 |
.br |
59 |
-When 'force = ${attribute}' (e.g. 'force = masters') attribute is not set, |
60 |
-\fBegencache\fR(1), \fBemirrordist\fR(1) and \fBrepoman\fR(1) ignore given |
61 |
-attribute, since operations performed by these tools are inherently |
62 |
+When 'force = masters' attribute is not set, \fBegencache\fR(1), |
63 |
+\fBemirrordist\fR(1) and \fBrepoman\fR(1) ignore this attribute, |
64 |
+since operations performed by these tools are inherently |
65 |
\fBnot\fR \fIsite\-specific\fR. |
66 |
.TP |
67 |
.B priority |
68 |
@@ -991,10 +986,9 @@ Specifies information about the repository layout. |
69 |
\fB/etc/portage/repos.conf\fR. |
70 |
Settings in \fBrepos.conf\fR take precedence over settings in |
71 |
\fBlayout.conf\fR, except tools such as \fBrepoman\fR(1) and \fBegencache\fR(1) |
72 |
-ignore "aliases", "eclass\-masters", "eclass\-overrides", "masters", |
73 |
-"package.mask\-masters", "use.aliases\-masters", "use.force\-masters" and |
74 |
-"use.mask\-masters" attributes set in \fBrepos.conf\fR since their operations |
75 |
-are inherently \fBnot\fR \fIsite\-specific\fR. |
76 |
+ignore "aliases", "eclass-overrides" and "masters" attributes set in |
77 |
+\fBrepos.conf\fR since their operations are inherently \fBnot\fR |
78 |
+\fIsite\-specific\fR. |
79 |
|
80 |
.I Format: |
81 |
.nf |
82 |
@@ -1002,7 +996,7 @@ are inherently \fBnot\fR \fIsite\-specific\fR. |
83 |
\- attributes are specified in "${attribute} = ${value}" format |
84 |
.fi |
85 |
|
86 |
-.I Supported attributes: |
87 |
+.I Supported attributes. |
88 |
.RS |
89 |
.RS |
90 |
.TP |
91 |
@@ -1015,14 +1009,6 @@ List of EAPIs which are not allowed in this repo. |
92 |
.BR eapis\-deprecated |
93 |
List of EAPIs which are allowed but generate warnings when used. |
94 |
.TP |
95 |
-.BR eclass\-masters |
96 |
-Names of repositories wherefrom eclasses can be inherited. |
97 |
-.br |
98 |
-This attribute overrides \fBmasters\fR attribute and should be used only when |
99 |
-there is a need to set this attribute to a different value than value of |
100 |
-\fBmasters\fR attribute. See documentation of \fBmasters\fR attribute for more |
101 |
-details. |
102 |
-.TP |
103 |
.BR masters |
104 |
Names of repositories which satisfy dependencies on eclasses and from which |
105 |
settings specified in various repository\-level files (\fBpackage.mask\fR, |
106 |
@@ -1032,15 +1018,6 @@ the repositories that is configured in \fBrepos.conf\fR file. Repositories |
107 |
listed toward the right of the \fBmasters\fR list take precedence over those |
108 |
listed toward the left of the list. |
109 |
.TP |
110 |
-.BR package.mask-masters |
111 |
-Names of repositories wherefrom settings specified in repository\-level |
112 |
-\fBpackage.mask\fR files are inherited. |
113 |
-.br |
114 |
-This attribute overrides \fBmasters\fR attribute and should be used only when |
115 |
-there is a need to set this attribute to a different value than value of |
116 |
-\fBmasters\fR attribute. See documentation of \fBmasters\fR attribute for more |
117 |
-details. |
118 |
-.TP |
119 |
.BR repo\-name " = <value of profiles/repo_name>" |
120 |
The name of this repository (overrides profiles/repo_name if it exists). |
121 |
.TP |
122 |
@@ -1053,35 +1030,6 @@ Boolean value whether we should sign Manifest files in this repo. |
123 |
.BR thin\-manifests " = [true|" false "]" |
124 |
Boolean value whether Manifest files contain only DIST entries. |
125 |
.TP |
126 |
-.BR use.aliases\-masters |
127 |
-Names of repositories wherefrom settings specified in repository\-level |
128 |
-\fBpackage.use.aliases\fR and \fBuse.aliases\fR files are inherited. |
129 |
-.br |
130 |
-This attribute overrides \fBmasters\fR attribute and should be used only when |
131 |
-there is a need to set this attribute to a different value than value of |
132 |
-\fBmasters\fR attribute. See documentation of \fBmasters\fR attribute for more |
133 |
-details. |
134 |
-.TP |
135 |
-.BR use.force\-masters |
136 |
-Names of repositories wherefrom settings specified in repository\-level |
137 |
-\fBpackage.use.force\fR, \fBpackage.use.stable.force\fR, \fBuse.force\fR and |
138 |
-\fBuse.stable.force\fR files are inherited. |
139 |
-.br |
140 |
-This attribute overrides \fBmasters\fR attribute and should be used only when |
141 |
-there is a need to set this attribute to a different value than value of |
142 |
-\fBmasters\fR attribute. See documentation of \fBmasters\fR attribute for more |
143 |
-details. |
144 |
-.TP |
145 |
-.BR use.mask\-masters |
146 |
-Names of repositories wherefrom settings specified in repository\-level |
147 |
-\fBpackage.use.mask\fR, \fBpackage.use.stable.mask\fR, \fuse.mask\fR and |
148 |
-\fBuse.stable.mask\fR files are inherited. |
149 |
-.br |
150 |
-This attribute overrides \fBmasters\fR attribute and should be used only when |
151 |
-there is a need to set this attribute to a different value than value of |
152 |
-\fBmasters\fR attribute. See documentation of \fBmasters\fR attribute for more |
153 |
-details. |
154 |
-.TP |
155 |
.BR use\-manifests " = [" strict "|true|false]" |
156 |
How Manifest files get used. Possible values are "strict" (require an entry |
157 |
for every file), "true" (if an entry exists for a file, enforce it), or "false" |
158 |
|
159 |
diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py |
160 |
index 4358b63..aeb04d7 100644 |
161 |
--- a/pym/portage/package/ebuild/_config/MaskManager.py |
162 |
+++ b/pym/portage/package/ebuild/_config/MaskManager.py |
163 |
@@ -1,4 +1,4 @@ |
164 |
-# Copyright 2010-2014 Gentoo Foundation |
165 |
+# Copyright 2010-2013 Gentoo Foundation |
166 |
# Distributed under the terms of the GNU General Public License v2 |
167 |
|
168 |
__all__ = ( |
169 |
@@ -58,11 +58,7 @@ class MaskManager(object): |
170 |
removals = frozenset(line[0][1:] for line in repo_lines |
171 |
if line[0][:1] == "-") |
172 |
matched_removals = set() |
173 |
- if repo.package_mask_masters is not None: |
174 |
- masters = repo.package_mask_masters |
175 |
- else: |
176 |
- masters = repo.masters |
177 |
- for master in masters: |
178 |
+ for master in repo.masters: |
179 |
master_lines = grab_pmask(master.location, master) |
180 |
for line in master_lines: |
181 |
if line[0] in removals: |
182 |
@@ -79,7 +75,7 @@ class MaskManager(object): |
183 |
# It's safe to warn for unmatched removal if masters have not |
184 |
# been overridden by the user, which is guaranteed when |
185 |
# user_config is false (when called by repoman). |
186 |
- if masters: |
187 |
+ if repo.masters: |
188 |
unmatched_removals = removals.difference(matched_removals) |
189 |
if unmatched_removals and not user_config: |
190 |
source_file = os.path.join(repo.location, |
191 |
|
192 |
diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py |
193 |
index a65e5bd..0d00810 100644 |
194 |
--- a/pym/portage/package/ebuild/_config/UseManager.py |
195 |
+++ b/pym/portage/package/ebuild/_config/UseManager.py |
196 |
@@ -1,4 +1,4 @@ |
197 |
-# Copyright 2010-2014 Gentoo Foundation |
198 |
+# Copyright 2010-2013 Gentoo Foundation |
199 |
# Distributed under the terms of the GNU General Public License v2 |
200 |
|
201 |
__all__ = ( |
202 |
@@ -312,11 +312,8 @@ class UseManager(object): |
203 |
if hasattr(pkg, "repo") and pkg.repo != Package.UNKNOWN_REPO: |
204 |
repos = [] |
205 |
try: |
206 |
- if self.repositories[pkg.repo].use_mask_masters is not None: |
207 |
- masters = self.repositories[pkg.repo].use_mask_masters |
208 |
- else: |
209 |
- masters = self.repositories[pkg.repo].masters |
210 |
- repos.extend(repo.name for repo in masters) |
211 |
+ repos.extend(repo.name for repo in |
212 |
+ self.repositories[pkg.repo].masters) |
213 |
except KeyError: |
214 |
pass |
215 |
repos.append(pkg.repo) |
216 |
@@ -375,11 +372,8 @@ class UseManager(object): |
217 |
if hasattr(pkg, "repo") and pkg.repo != Package.UNKNOWN_REPO: |
218 |
repos = [] |
219 |
try: |
220 |
- if self.repositories[pkg.repo].use_force_masters is not None: |
221 |
- masters = self.repositories[pkg.repo].use_force_masters |
222 |
- else: |
223 |
- masters = self.repositories[pkg.repo].masters |
224 |
- repos.extend(repo.name for repo in masters) |
225 |
+ repos.extend(repo.name for repo in |
226 |
+ self.repositories[pkg.repo].masters) |
227 |
except KeyError: |
228 |
pass |
229 |
repos.append(pkg.repo) |
230 |
@@ -434,11 +428,8 @@ class UseManager(object): |
231 |
if hasattr(pkg, "repo") and pkg.repo != Package.UNKNOWN_REPO: |
232 |
repos = [] |
233 |
try: |
234 |
- if self.repositories[pkg.repo].use_aliases_masters is not None: |
235 |
- masters = self.repositories[pkg.repo].use_aliases_masters |
236 |
- else: |
237 |
- masters = self.repositories[pkg.repo].masters |
238 |
- repos.extend(repo.name for repo in masters) |
239 |
+ repos.extend(repo.name for repo in |
240 |
+ self.repositories[pkg.repo].masters) |
241 |
except KeyError: |
242 |
pass |
243 |
repos.append(pkg.repo) |
244 |
|
245 |
diff --git a/pym/portage/package/ebuild/getmaskingreason.py b/pym/portage/package/ebuild/getmaskingreason.py |
246 |
index 673b40a..70a6bf2 100644 |
247 |
--- a/pym/portage/package/ebuild/getmaskingreason.py |
248 |
+++ b/pym/portage/package/ebuild/getmaskingreason.py |
249 |
@@ -1,4 +1,4 @@ |
250 |
-# Copyright 2010-2014 Gentoo Foundation |
251 |
+# Copyright 2010-2013 Gentoo Foundation |
252 |
# Distributed under the terms of the GNU General Public License v2 |
253 |
|
254 |
__all__ = ['getmaskingreason'] |
255 |
@@ -70,11 +70,7 @@ def getmaskingreason(mycpv, metadata=None, settings=None, |
256 |
|
257 |
locations = [] |
258 |
if pkg.repo in settings.repositories: |
259 |
- if settings.repositories[pkg.repo].package_mask_masters is not None: |
260 |
- masters = settings.repositories[pkg.repo].package_mask_masters |
261 |
- else: |
262 |
- masters = settings.repositories[pkg.repo].masters |
263 |
- for repo in masters + (settings.repositories[pkg.repo],): |
264 |
+ for repo in settings.repositories[pkg.repo].masters + (settings.repositories[pkg.repo],): |
265 |
locations.append(os.path.join(repo.location, "profiles")) |
266 |
locations.extend(settings.profiles) |
267 |
locations.append(os.path.join(settings["PORTAGE_CONFIGROOT"], |
268 |
|
269 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
270 |
index 952912e..5e0d055 100644 |
271 |
--- a/pym/portage/repository/config.py |
272 |
+++ b/pym/portage/repository/config.py |
273 |
@@ -45,9 +45,6 @@ _valid_profile_formats = frozenset( |
274 |
_portage1_profiles_allow_directories = frozenset( |
275 |
["portage-1-compat", "portage-1", 'portage-2']) |
276 |
|
277 |
-_masters_attributes = dict((x, x.replace("-", "_").replace(".", "_")) for x in |
278 |
- ("masters", "eclass-masters", "package.mask-masters", "use.aliases-masters", "use.force-masters", "use.mask-masters")) |
279 |
- |
280 |
_repo_name_sub_re = re.compile(r'[^\w-]') |
281 |
|
282 |
def _gen_valid_repo(name): |
283 |
@@ -84,12 +81,11 @@ class RepoConfig(object): |
284 |
'cache_formats', 'create_manifest', 'disable_manifest', 'eapi', |
285 |
'eclass_db', 'eclass_locations', 'eclass_overrides', |
286 |
'find_invalid_path_char', 'force', 'format', 'local_config', 'location', |
287 |
- 'main_repo', 'manifest_hashes', 'missing_repo_name', |
288 |
+ 'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', |
289 |
'name', 'portage1_profiles', 'portage1_profiles_compat', 'priority', |
290 |
'profile_formats', 'sign_commit', 'sign_manifest', 'sync_cvs_repo', |
291 |
'sync_type', 'sync_uri', 'thin_manifest', 'update_changelog', |
292 |
- 'user_location', '_eapis_banned', '_eapis_deprecated', '_masters_orig') + \ |
293 |
- tuple(_masters_attributes.values()) |
294 |
+ 'user_location', '_eapis_banned', '_eapis_deprecated', '_masters_orig') |
295 |
|
296 |
def __init__(self, name, repo_opts, local_config=True): |
297 |
"""Build a RepoConfig with options in repo_opts |
298 |
@@ -111,6 +107,7 @@ class RepoConfig(object): |
299 |
aliases = tuple(aliases.split()) |
300 |
else: |
301 |
aliases = None |
302 |
+ |
303 |
self.aliases = aliases |
304 |
|
305 |
if local_config or 'eclass-overrides' in force: |
306 |
@@ -119,21 +116,21 @@ class RepoConfig(object): |
307 |
eclass_overrides = tuple(eclass_overrides.split()) |
308 |
else: |
309 |
eclass_overrides = None |
310 |
- self.eclass_overrides = eclass_overrides |
311 |
|
312 |
+ self.eclass_overrides = eclass_overrides |
313 |
# Eclass databases and locations are computed later. |
314 |
self.eclass_db = None |
315 |
self.eclass_locations = None |
316 |
|
317 |
- for attr, underscorized_attr in _masters_attributes.items(): |
318 |
- if local_config or attr in force: |
319 |
- # Masters from repos.conf override layout.conf. |
320 |
- masters = repo_opts.get(attr) |
321 |
- if masters is not None: |
322 |
- masters = tuple(masters.split()) |
323 |
- else: |
324 |
- masters = None |
325 |
- setattr(self, underscorized_attr, masters) |
326 |
+ if local_config or 'masters' in force: |
327 |
+ # Masters from repos.conf override layout.conf. |
328 |
+ masters = repo_opts.get('masters') |
329 |
+ if masters is not None: |
330 |
+ masters = tuple(masters.split()) |
331 |
+ else: |
332 |
+ masters = None |
333 |
+ |
334 |
+ self.masters = masters |
335 |
|
336 |
#The main-repo key makes only sense for the 'DEFAULT' section. |
337 |
self.main_repo = repo_opts.get('main-repo') |
338 |
@@ -220,9 +217,8 @@ class RepoConfig(object): |
339 |
|
340 |
# layout.conf masters may be overridden here if we have a masters |
341 |
# setting from the user's repos.conf |
342 |
- for attr, underscorized_attr in _masters_attributes.items(): |
343 |
- if getattr(self, underscorized_attr) is None: |
344 |
- setattr(self, underscorized_attr, layout_data[attr]) |
345 |
+ if self.masters is None: |
346 |
+ self.masters = layout_data['masters'] |
347 |
|
348 |
if (local_config or 'aliases' in force) and layout_data['aliases']: |
349 |
aliases = self.aliases |
350 |
@@ -375,10 +371,8 @@ class RepoConfig(object): |
351 |
repo_msg.append(indent + "sync-type: " + self.sync_type) |
352 |
if self.sync_uri: |
353 |
repo_msg.append(indent + "sync-uri: " + self.sync_uri) |
354 |
- for attr, underscorized_attr in _masters_attributes.items(): |
355 |
- masters = getattr(self, underscorized_attr) |
356 |
- if masters: |
357 |
- repo_msg.append(indent + attr + ": " + " ".join(master.name for master in masters)) |
358 |
+ if self.masters: |
359 |
+ repo_msg.append(indent + "masters: " + " ".join(master.name for master in self.masters)) |
360 |
if self.priority is not None: |
361 |
repo_msg.append(indent + "priority: " + str(self.priority)) |
362 |
if self.aliases: |
363 |
@@ -750,43 +744,36 @@ class RepoConfigLoader(object): |
364 |
for repo_name, repo in prepos.items(): |
365 |
if repo_name == "DEFAULT": |
366 |
continue |
367 |
- for attr, underscorized_attr in _masters_attributes.items(): |
368 |
- masters = getattr(repo, underscorized_attr) |
369 |
- if masters is None: |
370 |
- if attr == 'masters': |
371 |
- if self.mainRepo() and repo_name != self.mainRepo().name: |
372 |
- setattr(repo, underscorized_attr, (self.mainRepo(),)) |
373 |
- else: |
374 |
- setattr(repo, underscorized_attr, ()) |
375 |
+ if repo.masters is None: |
376 |
+ if self.mainRepo() and repo_name != self.mainRepo().name: |
377 |
+ repo.masters = self.mainRepo(), |
378 |
else: |
379 |
- if masters and isinstance(masters[0], RepoConfig): |
380 |
- # This one has already been processed |
381 |
- # because it has an alias. |
382 |
- continue |
383 |
- master_repos = [] |
384 |
- for master_name in masters: |
385 |
- if master_name not in prepos: |
386 |
- layout_filename = os.path.join(repo.user_location, |
387 |
- "metadata", "layout.conf") |
388 |
- writemsg_level(_("Unavailable repository '%s' " \ |
389 |
- "referenced by %s attribute in '%s'\n") % \ |
390 |
- (master_name, attr, layout_filename), |
391 |
- level=logging.ERROR, noiselevel=-1) |
392 |
- else: |
393 |
- master_repos.append(prepos[master_name]) |
394 |
- setattr(repo, underscorized_attr, tuple(master_repos)) |
395 |
+ repo.masters = () |
396 |
+ else: |
397 |
+ if repo.masters and isinstance(repo.masters[0], RepoConfig): |
398 |
+ # This one has already been processed |
399 |
+ # because it has an alias. |
400 |
+ continue |
401 |
+ master_repos = [] |
402 |
+ for master_name in repo.masters: |
403 |
+ if master_name not in prepos: |
404 |
+ layout_filename = os.path.join(repo.user_location, |
405 |
+ "metadata", "layout.conf") |
406 |
+ writemsg_level(_("Unavailable repository '%s' " \ |
407 |
+ "referenced by masters entry in '%s'\n") % \ |
408 |
+ (master_name, layout_filename), |
409 |
+ level=logging.ERROR, noiselevel=-1) |
410 |
+ else: |
411 |
+ master_repos.append(prepos[master_name]) |
412 |
+ repo.masters = tuple(master_repos) |
413 |
|
414 |
#The 'eclass_overrides' key currently contains repo names. Replace them with the matching repo paths. |
415 |
for repo_name, repo in prepos.items(): |
416 |
if repo_name == "DEFAULT": |
417 |
continue |
418 |
|
419 |
- if repo.eclass_masters is not None: |
420 |
- masters = repo.eclass_masters |
421 |
- else: |
422 |
- masters = repo.masters |
423 |
eclass_locations = [] |
424 |
- eclass_locations.extend(master_repo.location for master_repo in masters) |
425 |
+ eclass_locations.extend(master_repo.location for master_repo in repo.masters) |
426 |
# Only append the current repo to eclass_locations if it's not |
427 |
# there already. This allows masters to have more control over |
428 |
# eclass override order, which may be useful for scenarios in |
429 |
@@ -935,24 +922,23 @@ class RepoConfigLoader(object): |
430 |
return repo_name in self.prepos |
431 |
|
432 |
def config_string(self): |
433 |
- str_or_int_attrs = ("format", "location", "main-repo", "priority", "sync-cvs-repo", "sync-type", "sync-uri") |
434 |
- str_tuple_attrs = ("aliases", "eclass-overrides", "force") |
435 |
- repo_config_tuple_attrs = tuple(_masters_attributes.keys()) |
436 |
- attrs = str_or_int_attrs + str_tuple_attrs + repo_config_tuple_attrs |
437 |
+ str_or_int_keys = ("format", "location", "main_repo", "priority", "sync_cvs_repo", "sync_type", "sync_uri") |
438 |
+ str_tuple_keys = ("aliases", "eclass_overrides", "force") |
439 |
+ repo_config_tuple_keys = ("masters",) |
440 |
+ keys = str_or_int_keys + str_tuple_keys + repo_config_tuple_keys |
441 |
config_string = "" |
442 |
for repo_name, repo in sorted(self.prepos.items(), key=lambda x: (x[0] != "DEFAULT", x[0])): |
443 |
config_string += "\n[%s]\n" % repo_name |
444 |
- for attr in sorted(attrs): |
445 |
- underscorized_attr = attr.replace("-", "_").replace(".", "_") |
446 |
- if attr == "main-repo" and repo_name != "DEFAULT": |
447 |
+ for key in sorted(keys): |
448 |
+ if key == "main_repo" and repo_name != "DEFAULT": |
449 |
continue |
450 |
- if getattr(repo, underscorized_attr) is not None: |
451 |
- if attr in str_or_int_attrs: |
452 |
- config_string += "%s = %s\n" % (attr, getattr(repo, underscorized_attr)) |
453 |
- elif attr in str_tuple_attrs: |
454 |
- config_string += "%s = %s\n" % (attr, " ".join(getattr(repo, underscorized_attr))) |
455 |
- elif attr in repo_config_tuple_attrs: |
456 |
- config_string += "%s = %s\n" % (attr, " ".join(x.name for x in getattr(repo, underscorized_attr))) |
457 |
+ if getattr(repo, key) is not None: |
458 |
+ if key in str_or_int_keys: |
459 |
+ config_string += "%s = %s\n" % (key.replace("_", "-"), getattr(repo, key)) |
460 |
+ elif key in str_tuple_keys: |
461 |
+ config_string += "%s = %s\n" % (key.replace("_", "-"), " ".join(getattr(repo, key))) |
462 |
+ elif key in repo_config_tuple_keys: |
463 |
+ config_string += "%s = %s\n" % (key.replace("_", "-"), " ".join(x.name for x in getattr(repo, key))) |
464 |
return config_string.lstrip("\n") |
465 |
|
466 |
def load_repository_config(settings, extra_files=None): |
467 |
@@ -986,17 +972,15 @@ def parse_layout_conf(repo_location, repo_name=None): |
468 |
|
469 |
data = {} |
470 |
|
471 |
- # None indicates absence of a masters setting, which later code uses |
472 |
+ # None indicates abscence of a masters setting, which later code uses |
473 |
# to trigger a backward compatibility fallback that sets an implicit |
474 |
# master. In order to avoid this fallback behavior, layout.conf can |
475 |
# explicitly set masters to an empty value, which will result in an |
476 |
# empty tuple here instead of None. |
477 |
- for attr in _masters_attributes.keys(): |
478 |
- masters = layout_data.get(attr) |
479 |
- if masters is not None: |
480 |
- masters = tuple(masters.split()) |
481 |
- data[attr] = masters |
482 |
- |
483 |
+ masters = layout_data.get('masters') |
484 |
+ if masters is not None: |
485 |
+ masters = tuple(masters.split()) |
486 |
+ data['masters'] = masters |
487 |
data['aliases'] = tuple(layout_data.get('aliases', '').split()) |
488 |
|
489 |
data['allow-provide-virtual'] = \ |