public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r11996 - main/branches/2.1.6/pym/_emerge
@ 2008-11-18 21:25 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-11-18 21:25 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-11-18 21:25:11 +0000 (Tue, 18 Nov 2008)
New Revision: 11996

Modified:
   main/branches/2.1.6/pym/_emerge/__init__.py
Log:
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)


Modified: main/branches/2.1.6/pym/_emerge/__init__.py
===================================================================
--- main/branches/2.1.6/pym/_emerge/__init__.py	2008-11-18 21:22:48 UTC (rev 11995)
+++ main/branches/2.1.6/pym/_emerge/__init__.py	2008-11-18 21:25:11 UTC (rev 11996)
@@ -13381,6 +13381,32 @@
 
 	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 @@
 
 	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():




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-18 21:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 21:25 [gentoo-commits] portage r11996 - main/branches/2.1.6/pym/_emerge Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox