summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-15 20:55:10 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-15 20:55:10 +0000
commit6bdf6f520f075b254fc6660f5aac1c4f4f2fd4d4 (patch)
treed90b4000a3d0f14bf3eb3d187876a302c83b0340 /pym
parentccea8172b47c34eb64e298c1a66a8199423d5e07 (diff)
downloadportage-6bdf6f520f075b254fc6660f5aac1c4f4f2fd4d4.tar.gz
portage-6bdf6f520f075b254fc6660f5aac1c4f4f2fd4d4.tar.bz2
portage-6bdf6f520f075b254fc6660f5aac1c4f4f2fd4d4.zip
Bug #265909 - Make emerge display a warning message if any overlays are
ignored due to duplicate profiles/repo_name entries. The warning can be disabled by setting PORTAGE_REPO_DUPLICATE_WARN=0 in /etc/make.conf. svn path=/main/trunk/; revision=13348
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py32
-rw-r--r--pym/portage/__init__.py1
-rw-r--r--pym/portage/dbapi/porttree.py9
3 files changed, 40 insertions, 2 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 947dd0780..692a2a144 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -15573,6 +15573,37 @@ def repo_name_check(trees):
return bool(missing_repo_names)
+def repo_name_duplicate_check(trees):
+ ignored_repos = {}
+ for root, root_trees in trees.iteritems():
+ if 'porttree' in root_trees:
+ portdb = root_trees['porttree'].dbapi
+ if portdb.mysettings.get('PORTAGE_REPO_DUPLICATE_WARN') != '0':
+ for repo_name, paths in portdb._ignored_repos:
+ k = (root, repo_name, portdb.getRepositoryPath(repo_name))
+ ignored_repos.setdefault(k, []).extend(paths)
+
+ if ignored_repos:
+ msg = []
+ msg.append('WARNING: One or more repositories ' + \
+ 'have been ignored due to duplicate')
+ msg.append(' profiles/repo_name entries:')
+ msg.append('')
+ for k in sorted(ignored_repos):
+ msg.append(' %s overrides' % (k,))
+ for path in ignored_repos[k]:
+ msg.append(' %s' % (path,))
+ msg.append('')
+ msg.extend(' ' + x for x in textwrap.wrap(
+ "All profiles/repo_name entries must be unique in order " + \
+ "to avoid having duplicates ignored. " + \
+ "Set PORTAGE_REPO_DUPLICATE_WARN=\"0\" in " + \
+ "/etc/make.conf if you would like to disable this warning."))
+ writemsg_level(''.join('%s\n' % l for l in msg),
+ level=logging.WARNING, noiselevel=-1)
+
+ return bool(ignored_repos)
+
def config_protect_check(trees):
for root, root_trees in trees.iteritems():
if not root_trees["root_config"].settings.get("CONFIG_PROTECT"):
@@ -15690,6 +15721,7 @@ def emerge_main():
if "--quiet" not in myopts:
portage.deprecated_profile_check(settings=settings)
repo_name_check(trees)
+ repo_name_duplicate_check(trees)
config_protect_check(trees)
for mytrees in trees.itervalues():
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 0b65570c0..8e73e211a 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1132,6 +1132,7 @@ class config(object):
"PORTAGE_GPG_DIR",
"PORTAGE_GPG_KEY", "PORTAGE_IONICE_COMMAND",
"PORTAGE_PACKAGE_EMPTY_ABORT",
+ "PORTAGE_REPO_DUPLICATE_WARN",
"PORTAGE_RO_DISTDIRS",
"PORTAGE_RSYNC_EXTRA_OPTS", "PORTAGE_RSYNC_OPTS",
"PORTAGE_RSYNC_RETRIES", "PORTAGE_USE", "PORT_LOGDIR",
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index ed9ed99a4..a9496c8eb 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -143,7 +143,7 @@ class portdbapi(dbapi):
repository_map = {}
self.treemap = treemap
self._repository_map = repository_map
- identically_named_paths = set()
+ identically_named_paths = {}
for path in porttrees:
if path in repository_map:
continue
@@ -160,7 +160,7 @@ class portdbapi(dbapi):
if identically_named_path is not None:
# The earlier one is discarded.
del repository_map[identically_named_path]
- identically_named_paths.add(identically_named_path)
+ identically_named_paths[identically_named_path] = repo_name
if identically_named_path == porttrees[0]:
# Found another repo with the same name as
# $PORTDIR, so update porttrees[0] to match.
@@ -171,6 +171,11 @@ class portdbapi(dbapi):
# Ensure that each repo_name is unique. Later paths override
# earlier ones that correspond to the same name.
porttrees = [x for x in porttrees if x not in identically_named_paths]
+ ignored_map = {}
+ for path, repo_name in identically_named_paths.iteritems():
+ ignored_map.setdefault(repo_name, []).append(path)
+ self._ignored_repos = tuple((repo_name, tuple(paths)) \
+ for repo_name, paths in ignored_map.iteritems())
self.porttrees = porttrees
porttree_root = porttrees[0]