From a50e6a22a84f0386489b63e1670974d3f51438cc Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 18 Nov 2008 21:25:11 +0000 Subject: [PATCH] When warning about 'missing repo_name', also give the exact path where the 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. (trunk r11993:11995) svn path=/main/branches/2.1.6/; revision=11996 --- pym/_emerge/__init__.py | 42 ++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 1b9e18589..64ebb9359 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -13381,6 +13381,32 @@ def expand_set_arguments(myfiles, myaction, root_config): return (myfiles, os.EX_OK) +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() @@ -13441,21 +13467,7 @@ def emerge_main(): if "--quiet" not in myopts: portage.deprecated_profile_check() - 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] - 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) - + repo_name_check(trees) eclasses_overridden = {} for mytrees in trees.itervalues(): -- 2.26.2