Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11996 - main/branches/2.1.6/pym/_emerge
Date: Tue, 18 Nov 2008 21:25:15
Message-Id: E1L2Y4O-0001ve-Q3@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-11-18 21:25:11 +0000 (Tue, 18 Nov 2008)
3 New Revision: 11996
4
5 Modified:
6 main/branches/2.1.6/pym/_emerge/__init__.py
7 Log:
8 When warning about 'missing repo_name', also give the exact path where the
9 entry should exist, and explain that it should be a plain text file containing
10 a unique name of the first line. This should give the users enough information
11 to correct the problem without needing to seek help. (trunk r11993:11995)
12
13
14 Modified: main/branches/2.1.6/pym/_emerge/__init__.py
15 ===================================================================
16 --- main/branches/2.1.6/pym/_emerge/__init__.py 2008-11-18 21:22:48 UTC (rev 11995)
17 +++ main/branches/2.1.6/pym/_emerge/__init__.py 2008-11-18 21:25:11 UTC (rev 11996)
18 @@ -13381,6 +13381,32 @@
19
20 return (myfiles, os.EX_OK)
21
22 +def repo_name_check(trees):
23 + missing_repo_names = set()
24 + for root, root_trees in trees.iteritems():
25 + if "porttree" in root_trees:
26 + portdb = root_trees["porttree"].dbapi
27 + missing_repo_names.update(portdb.porttrees)
28 + repos = portdb.getRepositories()
29 + for r in repos:
30 + missing_repo_names.discard(portdb.getRepositoryPath(r))
31 +
32 + if missing_repo_names:
33 + msg = []
34 + msg.append("WARNING: One or more repositories " + \
35 + "have missing repo_name entries:")
36 + msg.append("")
37 + for p in missing_repo_names:
38 + msg.append("\t%s/profiles/repo_name" % (p,))
39 + msg.append("")
40 + msg.extend(textwrap.wrap("NOTE: Each repo_name entry " + \
41 + "should be a plain text file containing a unique " + \
42 + "name for the repository on the first line.", 70))
43 + writemsg_level("".join("%s\n" % l for l in msg),
44 + level=logging.WARNING, noiselevel=-1)
45 +
46 + return bool(missing_repo_names)
47 +
48 def emerge_main():
49 global portage # NFC why this is necessary now - genone
50 portage._disable_legacy_globals()
51 @@ -13441,21 +13467,7 @@
52
53 if "--quiet" not in myopts:
54 portage.deprecated_profile_check()
55 - for root in trees:
56 - if "porttree" in trees[root]:
57 - db = trees[root]["porttree"].dbapi
58 - paths = (db.mysettings["PORTDIR"]+" "+db.mysettings["PORTDIR_OVERLAY"]).split()
59 - paths = [os.path.realpath(p) for p in paths]
60 - repos = db.getRepositories()
61 - for r in repos:
62 - p = db.getRepositoryPath(r)
63 - try:
64 - paths.remove(p)
65 - except ValueError:
66 - pass
67 - for p in paths:
68 - writemsg("WARNING: repository at %s is missing a repo_name entry\n" % p)
69 -
70 + repo_name_check(trees)
71
72 eclasses_overridden = {}
73 for mytrees in trees.itervalues():