When warning about 'missing repo_name', also give the exact path where the
authorZac Medico <zmedico@gentoo.org>
Tue, 18 Nov 2008 21:13:03 +0000 (21:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 18 Nov 2008 21:13:03 +0000 (21:13 -0000)
entry should exist, and explain that it should be a plain text file containing
a unique name of the first line. This should give the users enough information
to correct the problem without needing to seek help.

svn path=/main/trunk/; revision=11994

pym/_emerge/__init__.py

index 415c9595a42fc6e6b8524af40baabab925fe5d32..b893982004705a0a39a403f716430b23684c8c6a 100644 (file)
@@ -13904,21 +13904,29 @@ 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()
-                               paths = [os.path.realpath(p) for p in paths]
+                               missing_repo_names.update(os.path.realpath(p) for p in paths)
                                repos = db.getRepositories()
                                for r in repos:
-                                       p = db.getRepositoryPath(r)
-                                       try:
-                                               paths.remove(p)
-                                       except ValueError:
-                                               pass
-                               for p in paths:
-                                       writemsg("WARNING: repository at %s is missing a repo_name entry\n" % p)
-                                       
+                                       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)
 
        eclasses_overridden = {}
        for mytrees in trees.itervalues():