1 |
commit: 71fe8dac63a91b0fc8ca425ac2068a80b726a32f |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Apr 26 20:19:34 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 26 20:19:34 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71fe8dac |
7 |
|
8 |
emerge --info: support new-style virtuals |
9 |
|
10 |
This will fix bug #364673. |
11 |
|
12 |
--- |
13 |
pym/_emerge/actions.py | 85 +++++++++++++++++++++++++++++++++++------------- |
14 |
1 files changed, 62 insertions(+), 23 deletions(-) |
15 |
|
16 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
17 |
index 53d1880..43707d2 100644 |
18 |
--- a/pym/_emerge/actions.py |
19 |
+++ b/pym/_emerge/actions.py |
20 |
@@ -1289,6 +1289,40 @@ def action_deselect(settings, trees, opts, atoms): |
21 |
world_set.unlock() |
22 |
return os.EX_OK |
23 |
|
24 |
+def expand_new_virt(vardb, atom, _traversed=None): |
25 |
+ """ |
26 |
+ Iterate over the recursively expanded RDEPEND atoms of |
27 |
+ s new-style virtual. If atom is not a new-style virtual |
28 |
+ or it does not match an installed package then it is |
29 |
+ yielded without any expansion. |
30 |
+ """ |
31 |
+ matches = vardb.match(atom) |
32 |
+ if not (matches and portage.cpv_getkey(matches[-1]).startswith("virtual/")): |
33 |
+ yield atom |
34 |
+ return |
35 |
+ |
36 |
+ virt_cpv = matches[-1] |
37 |
+ rdepend, use = vardb.aux_get(virt_cpv, ["RDEPEND", "USE"]) |
38 |
+ use = frozenset(use.split()) |
39 |
+ success, atoms = portage.dep_check(rdepend, |
40 |
+ None, vardb.settings, myuse=use, |
41 |
+ myroot=vardb.root, trees={vardb.root:{"porttree":vardb.vartree, |
42 |
+ "vartree":vardb.vartree}}) |
43 |
+ |
44 |
+ if not success: |
45 |
+ yield atom |
46 |
+ return |
47 |
+ |
48 |
+ if _traversed is None: |
49 |
+ _traversed = set([atom]) |
50 |
+ |
51 |
+ for child1 in atoms: |
52 |
+ if child1 not in _traversed: |
53 |
+ _traversed.add(child1) |
54 |
+ for child2 in expand_new_virt(vardb, child1, |
55 |
+ _traversed=_traversed): |
56 |
+ yield child2 |
57 |
+ |
58 |
class _info_pkgs_ver(object): |
59 |
def __init__(self, ver, repo_suffix, provide_suffix): |
60 |
self.ver = ver |
61 |
@@ -1349,15 +1383,25 @@ def action_info(settings, trees, myopts, myfiles): |
62 |
myvars = ["sys-devel/autoconf", "sys-devel/automake", "virtual/os-headers", |
63 |
"sys-devel/binutils", "sys-devel/libtool", "dev-lang/python"] |
64 |
myvars += portage.util.grabfile(settings["PORTDIR"]+"/profiles/info_pkgs") |
65 |
- myvars = portage.util.unique_array(myvars) |
66 |
- myvars.sort() |
67 |
+ atoms = [] |
68 |
+ vardb = trees["/"]["vartree"].dbapi |
69 |
+ for x in myvars: |
70 |
+ try: |
71 |
+ x = Atom(x) |
72 |
+ except InvalidAtom: |
73 |
+ writemsg_stdout("%-20s %s\n" % (x+":", "[NOT VALID]"), |
74 |
+ noiselevel=-1) |
75 |
+ else: |
76 |
+ for atom in expand_new_virt(vardb, x): |
77 |
+ if not atom.blocker: |
78 |
+ atoms.append((x, atom)) |
79 |
+ |
80 |
+ myvars = sorted(set(atoms)) |
81 |
|
82 |
portdb = trees["/"]["porttree"].dbapi |
83 |
- vardb = trees["/"]["vartree"].dbapi |
84 |
main_repo = portdb.getRepositoryName(portdb.porttree_root) |
85 |
|
86 |
- for x in myvars: |
87 |
- if portage.isvalidatom(x): |
88 |
+ for orig_atom, x in myvars: |
89 |
pkg_matches = vardb.match(x) |
90 |
|
91 |
versions = [] |
92 |
@@ -1372,10 +1416,10 @@ def action_info(settings, trees, myopts, myfiles): |
93 |
repo_suffix = "::" + repo |
94 |
|
95 |
matched_cp = portage.versions.cpv_getkey(cpv) |
96 |
- if matched_cp == x: |
97 |
+ if matched_cp == orig_atom.cp: |
98 |
provide_suffix = "" |
99 |
else: |
100 |
- provide_suffix = " (%s)" % matched_cp |
101 |
+ provide_suffix = " (%s)" % (orig_atom,) |
102 |
|
103 |
versions.append( |
104 |
_info_pkgs_ver(ver, repo_suffix, provide_suffix)) |
105 |
@@ -1386,9 +1430,6 @@ def action_info(settings, trees, myopts, myfiles): |
106 |
versions = ", ".join(ver.toString() for ver in versions) |
107 |
writemsg_stdout("%-20s %s\n" % (x+":", versions), |
108 |
noiselevel=-1) |
109 |
- else: |
110 |
- writemsg_stdout("%-20s %s\n" % (x+":", "[NOT VALID]"), |
111 |
- noiselevel=-1) |
112 |
|
113 |
libtool_vers = ",".join(trees["/"]["vartree"].dbapi.match("sys-devel/libtool")) |
114 |
|
115 |
@@ -2788,24 +2829,22 @@ def getportageversion(portdir, target_root, profile, chost, vardb): |
116 |
if profilever is None: |
117 |
profilever = "unavailable" |
118 |
|
119 |
- libcver=[] |
120 |
- libclist = vardb.match("virtual/libc") |
121 |
- libclist += vardb.match("virtual/glibc") |
122 |
- libclist = portage.util.unique_array(libclist) |
123 |
- for x in libclist: |
124 |
- xs=portage.catpkgsplit(x) |
125 |
- if libcver: |
126 |
- libcver+=","+"-".join(xs[1:]) |
127 |
- else: |
128 |
- libcver="-".join(xs[1:]) |
129 |
- if libcver==[]: |
130 |
- libcver="unavailable" |
131 |
+ libcver = [] |
132 |
+ libclist = set() |
133 |
+ for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): |
134 |
+ if not atom.blocker: |
135 |
+ libclist.update(vardb.match(atom)) |
136 |
+ if libclist: |
137 |
+ for cpv in sorted(libclist): |
138 |
+ libcver.append("-".join(portage.catpkgsplit(cpv)[1:])) |
139 |
+ else: |
140 |
+ libcver = ["unavailable"] |
141 |
|
142 |
gccver = getgccversion(chost) |
143 |
unameout=platform.release()+" "+platform.machine() |
144 |
|
145 |
return "Portage %s (%s, %s, %s, %s)" % \ |
146 |
- (portage.VERSION, profilever, gccver, libcver, unameout) |
147 |
+ (portage.VERSION, profilever, gccver, ",".join(libcver), unameout) |
148 |
|
149 |
def git_sync_timestamps(settings, portdir): |
150 |
""" |