1 |
Author: zmedico |
2 |
Date: 2009-04-30 07:12:58 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 13504 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/pym/_emerge/__init__.py |
7 |
main/branches/2.1.6/pym/portage/__init__.py |
8 |
main/branches/2.1.6/pym/portage/dbapi/porttree.py |
9 |
Log: |
10 |
Bug #265909 - Make emerge display a warning message if any overlays are |
11 |
ignored due to duplicate profiles/repo_name entries. The warning can be |
12 |
disabled by setting PORTAGE_REPO_DUPLICATE_WARN=0 in /etc/make.conf. |
13 |
(trunk r13348) |
14 |
|
15 |
Modified: main/branches/2.1.6/pym/_emerge/__init__.py |
16 |
=================================================================== |
17 |
--- main/branches/2.1.6/pym/_emerge/__init__.py 2009-04-30 07:12:41 UTC (rev 13503) |
18 |
+++ main/branches/2.1.6/pym/_emerge/__init__.py 2009-04-30 07:12:58 UTC (rev 13504) |
19 |
@@ -15086,6 +15086,37 @@ |
20 |
|
21 |
return bool(missing_repo_names) |
22 |
|
23 |
+def repo_name_duplicate_check(trees): |
24 |
+ ignored_repos = {} |
25 |
+ for root, root_trees in trees.iteritems(): |
26 |
+ if 'porttree' in root_trees: |
27 |
+ portdb = root_trees['porttree'].dbapi |
28 |
+ if portdb.mysettings.get('PORTAGE_REPO_DUPLICATE_WARN') != '0': |
29 |
+ for repo_name, paths in portdb._ignored_repos: |
30 |
+ k = (root, repo_name, portdb.getRepositoryPath(repo_name)) |
31 |
+ ignored_repos.setdefault(k, []).extend(paths) |
32 |
+ |
33 |
+ if ignored_repos: |
34 |
+ msg = [] |
35 |
+ msg.append('WARNING: One or more repositories ' + \ |
36 |
+ 'have been ignored due to duplicate') |
37 |
+ msg.append(' profiles/repo_name entries:') |
38 |
+ msg.append('') |
39 |
+ for k in sorted(ignored_repos): |
40 |
+ msg.append(' %s overrides' % (k,)) |
41 |
+ for path in ignored_repos[k]: |
42 |
+ msg.append(' %s' % (path,)) |
43 |
+ msg.append('') |
44 |
+ msg.extend(' ' + x for x in textwrap.wrap( |
45 |
+ "All profiles/repo_name entries must be unique in order " + \ |
46 |
+ "to avoid having duplicates ignored. " + \ |
47 |
+ "Set PORTAGE_REPO_DUPLICATE_WARN=\"0\" in " + \ |
48 |
+ "/etc/make.conf if you would like to disable this warning.")) |
49 |
+ writemsg_level(''.join('%s\n' % l for l in msg), |
50 |
+ level=logging.WARNING, noiselevel=-1) |
51 |
+ |
52 |
+ return bool(ignored_repos) |
53 |
+ |
54 |
def config_protect_check(trees): |
55 |
for root, root_trees in trees.iteritems(): |
56 |
if not root_trees["root_config"].settings.get("CONFIG_PROTECT"): |
57 |
@@ -15203,6 +15234,7 @@ |
58 |
if "--quiet" not in myopts: |
59 |
portage.deprecated_profile_check(settings=settings) |
60 |
#repo_name_check(trees) |
61 |
+ repo_name_duplicate_check(trees) |
62 |
config_protect_check(trees) |
63 |
|
64 |
for mytrees in trees.itervalues(): |
65 |
|
66 |
Modified: main/branches/2.1.6/pym/portage/__init__.py |
67 |
=================================================================== |
68 |
--- main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:12:41 UTC (rev 13503) |
69 |
+++ main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:12:58 UTC (rev 13504) |
70 |
@@ -1132,6 +1132,7 @@ |
71 |
"PORTAGE_GPG_DIR", |
72 |
"PORTAGE_GPG_KEY", "PORTAGE_IONICE_COMMAND", |
73 |
"PORTAGE_PACKAGE_EMPTY_ABORT", |
74 |
+ "PORTAGE_REPO_DUPLICATE_WARN", |
75 |
"PORTAGE_RO_DISTDIRS", |
76 |
"PORTAGE_RSYNC_EXTRA_OPTS", "PORTAGE_RSYNC_OPTS", |
77 |
"PORTAGE_RSYNC_RETRIES", "PORTAGE_USE", "PORT_LOGDIR", |
78 |
|
79 |
Modified: main/branches/2.1.6/pym/portage/dbapi/porttree.py |
80 |
=================================================================== |
81 |
--- main/branches/2.1.6/pym/portage/dbapi/porttree.py 2009-04-30 07:12:41 UTC (rev 13503) |
82 |
+++ main/branches/2.1.6/pym/portage/dbapi/porttree.py 2009-04-30 07:12:58 UTC (rev 13504) |
83 |
@@ -143,7 +143,7 @@ |
84 |
repository_map = {} |
85 |
self.treemap = treemap |
86 |
self._repository_map = repository_map |
87 |
- identically_named_paths = set() |
88 |
+ identically_named_paths = {} |
89 |
for path in porttrees: |
90 |
if path in repository_map: |
91 |
continue |
92 |
@@ -160,7 +160,7 @@ |
93 |
if identically_named_path is not None: |
94 |
# The earlier one is discarded. |
95 |
del repository_map[identically_named_path] |
96 |
- identically_named_paths.add(identically_named_path) |
97 |
+ identically_named_paths[identically_named_path] = repo_name |
98 |
if identically_named_path == porttrees[0]: |
99 |
# Found another repo with the same name as |
100 |
# $PORTDIR, so update porttrees[0] to match. |
101 |
@@ -171,6 +171,11 @@ |
102 |
# Ensure that each repo_name is unique. Later paths override |
103 |
# earlier ones that correspond to the same name. |
104 |
porttrees = [x for x in porttrees if x not in identically_named_paths] |
105 |
+ ignored_map = {} |
106 |
+ for path, repo_name in identically_named_paths.iteritems(): |
107 |
+ ignored_map.setdefault(repo_name, []).append(path) |
108 |
+ self._ignored_repos = tuple((repo_name, tuple(paths)) \ |
109 |
+ for repo_name, paths in ignored_map.iteritems()) |
110 |
|
111 |
self.porttrees = porttrees |
112 |
porttree_root = porttrees[0] |