1 |
Searching contents for the /bin/sh provider is somewhat slow. |
2 |
Therefore, use the basename of the symlink target to locate the |
3 |
package. If this fails, then only the basename of the symlink target |
4 |
will be displayed. So, typical output is something like |
5 |
"sh bash 4.2_p53", or "sh bb" if /bin/sh points to something like bb |
6 |
that doesn't map to a package name. Note that we do not parse the |
7 |
output of "/bin/sh --version" because many shells do not have |
8 |
a --version option. |
9 |
|
10 |
The relevant section of the emerge --info output will now look |
11 |
something like this: |
12 |
|
13 |
Timestamp of tree: Fri, 28 Nov 2014 00:45:01 +0000 |
14 |
sh bash 4.2_p53 |
15 |
ld GNU ld (Gentoo 2.23.2 p1.0) 2.23.2 |
16 |
|
17 |
X-Gentoo-Bug: 527996 |
18 |
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=527996 |
19 |
--- |
20 |
pym/_emerge/actions.py | 35 +++++++++++++++++++++++++++++++++++ |
21 |
1 file changed, 35 insertions(+) |
22 |
|
23 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
24 |
index dec5b04..bd88547 100644 |
25 |
--- a/pym/_emerge/actions.py |
26 |
+++ b/pym/_emerge/actions.py |
27 |
@@ -1556,6 +1556,41 @@ def action_info(settings, trees, myopts, myfiles): |
28 |
lastSync = "Unknown" |
29 |
append("Timestamp of tree: %s" % (lastSync,)) |
30 |
|
31 |
+ # Searching contents for the /bin/sh provider is somewhat |
32 |
+ # slow. Therefore, use the basename of the symlink target |
33 |
+ # to locate the package. If this fails, then only the |
34 |
+ # basename of the symlink target will be displayed. So, |
35 |
+ # typical output is something like "sh bash 4.2_p53", or |
36 |
+ # "sh bb" if /bin/sh points to something like bb that |
37 |
+ # doesn't map to a package name. Note that we do not parse |
38 |
+ # the output of "/bin/sh --version" because many shells |
39 |
+ # do not have a --version option. |
40 |
+ basename = os.path.basename(os.path.realpath(os.path.join( |
41 |
+ os.sep, portage.const.EPREFIX, "bin", "sh"))) |
42 |
+ try: |
43 |
+ # Try a match against the basename, which should work for |
44 |
+ # busybox and most shells. |
45 |
+ matches = (trees[trees._running_eroot]["vartree"].dbapi. |
46 |
+ match(basename)) |
47 |
+ except portage.exception.AmbiguousPackageName: |
48 |
+ # If the name is ambiguous, then restrict our match |
49 |
+ # to the app-shells category. |
50 |
+ matches = (trees[trees._running_eroot]["vartree"].dbapi. |
51 |
+ match("app-shells/%s" % basename)) |
52 |
+ |
53 |
+ if matches: |
54 |
+ pkg = matches[-1] |
55 |
+ name = pkg.cp |
56 |
+ version = pkg.version |
57 |
+ # Omit app-shells category from the output. |
58 |
+ if name.startswith("app-shells/"): |
59 |
+ name = name[len("app-shells/"):] |
60 |
+ sh_str = "%s %s" % (name, version) |
61 |
+ else: |
62 |
+ sh_str = basename |
63 |
+ |
64 |
+ append("sh %s" % sh_str) |
65 |
+ |
66 |
ld_names = [] |
67 |
if chost: |
68 |
ld_names.append(chost + "-ld") |
69 |
-- |
70 |
2.0.4 |