summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-18 21:22:48 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-18 21:22:48 +0000
commit258dc8b45bc6f2aefe4d6fa00f6eee182fa6ce15 (patch)
tree2f6ec04c40cbdfab255099d3ca4d2c18de27f792
parentb9e5ca3fa7a4321885a9e750b8af696c248bf03c (diff)
downloadportage-258dc8b45bc6f2aefe4d6fa00f6eee182fa6ce15.tar.gz
portage-258dc8b45bc6f2aefe4d6fa00f6eee182fa6ce15.tar.bz2
portage-258dc8b45bc6f2aefe4d6fa00f6eee182fa6ce15.zip
Move the repo_name check/warning into a function.
svn path=/main/trunk/; revision=11995
-rw-r--r--pym/_emerge/__init__.py50
1 files changed, 27 insertions, 23 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index b89398200..dcd02f2b1 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -13844,6 +13844,32 @@ def expand_set_arguments(myfiles, myaction, root_config):
newargs.append(a)
return (newargs, retval)
+def repo_name_check(trees):
+ missing_repo_names = set()
+ for root, root_trees in trees.iteritems():
+ if "porttree" in root_trees:
+ portdb = root_trees["porttree"].dbapi
+ missing_repo_names.update(portdb.porttrees)
+ repos = portdb.getRepositories()
+ for r in repos:
+ missing_repo_names.discard(portdb.getRepositoryPath(r))
+
+ if missing_repo_names:
+ msg = []
+ msg.append("WARNING: One or more repositories " + \
+ "have missing repo_name entries:")
+ msg.append("")
+ for p in missing_repo_names:
+ msg.append("\t%s/profiles/repo_name" % (p,))
+ msg.append("")
+ msg.extend(textwrap.wrap("NOTE: Each repo_name entry " + \
+ "should be a plain text file containing a unique " + \
+ "name for the repository on the first line.", 70))
+ writemsg_level("".join("%s\n" % l for l in msg),
+ level=logging.WARNING, noiselevel=-1)
+
+ return bool(missing_repo_names)
+
def emerge_main():
global portage # NFC why this is necessary now - genone
portage._disable_legacy_globals()
@@ -13904,29 +13930,7 @@ def emerge_main():
if "--quiet" not in myopts:
portage.deprecated_profile_check()
- missing_repo_names = set()
- for root in trees:
- if "porttree" in trees[root]:
- db = trees[root]["porttree"].dbapi
- paths = (db.mysettings["PORTDIR"]+" "+db.mysettings["PORTDIR_OVERLAY"]).split()
- missing_repo_names.update(os.path.realpath(p) for p in paths)
- repos = db.getRepositories()
- for r in repos:
- missing_repo_names.discard(db.getRepositoryPath(r))
-
- if missing_repo_names:
- msg = []
- msg.append("WARNING: One or more repositories " + \
- "have missing repo_name entries:")
- msg.append("")
- for p in missing_repo_names:
- msg.append("\t%s/profiles/repo_name" % (p,))
- msg.append("")
- msg.extend(textwrap.wrap("NOTE: Each repo_name entry " + \
- "should be a plain text file containing a unique " + \
- "name for the repository on the first line.", 70))
- writemsg_level("".join("%s\n" % l for l in msg),
- level=logging.WARNING, noiselevel=-1)
+ repo_name_check(trees)
eclasses_overridden = {}
for mytrees in trees.itervalues():