1 |
commit: 3b0e4011279670b82d9a590ee6a43f027552a3ef |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 1 18:42:54 2011 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 1 18:42:54 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3b0e4011 |
7 |
|
8 |
LinkageMapMachO: sync with changes in LinkageMapELF |
9 |
|
10 |
--- |
11 |
pym/portage/util/_dyn_libs/LinkageMapMachO.py | 25 ++++++++++++++++++------- |
12 |
1 files changed, 18 insertions(+), 7 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/util/_dyn_libs/LinkageMapMachO.py b/pym/portage/util/_dyn_libs/LinkageMapMachO.py |
15 |
index eb62e91..54784f3 100644 |
16 |
--- a/pym/portage/util/_dyn_libs/LinkageMapMachO.py |
17 |
+++ b/pym/portage/util/_dyn_libs/LinkageMapMachO.py |
18 |
@@ -59,7 +59,7 @@ class LinkageMapMachO(object): |
19 |
|
20 |
"""Helper class used as _obj_properties keys for objects.""" |
21 |
|
22 |
- __slots__ = ("_key") |
23 |
+ __slots__ = ("_key",) |
24 |
|
25 |
def __init__(self, obj, root): |
26 |
""" |
27 |
@@ -459,7 +459,16 @@ class LinkageMapMachO(object): |
28 |
|
29 |
def isMasterLink(self, obj): |
30 |
""" |
31 |
- Determine whether an object is a master link. |
32 |
+ Determine whether an object is a "master" symlink, which means |
33 |
+ that its basename is the same as the beginning part of the |
34 |
+ soname and it lacks the soname's version component. |
35 |
+ |
36 |
+ Examples: |
37 |
+ |
38 |
+ install_name | master symlink name |
39 |
+ ----------------------------------------------- |
40 |
+ libarchive.2.8.4.dylib | libarchive.dylib |
41 |
+ (typically the install_name is libarchive.2.dylib) |
42 |
|
43 |
@param obj: absolute path to an object |
44 |
@type obj: string (example: '/usr/bin/foo') |
45 |
@@ -470,12 +479,14 @@ class LinkageMapMachO(object): |
46 |
|
47 |
""" |
48 |
os = _os_merge |
49 |
- basename = os.path.basename(obj) |
50 |
obj_key = self._obj_key(obj) |
51 |
if obj_key not in self._obj_properties: |
52 |
raise KeyError("%s (%s) not in object list" % (obj_key, obj)) |
53 |
+ basename = os.path.basename(obj) |
54 |
install_name = self._obj_properties[obj_key][2] |
55 |
- return (len(basename) < len(os.path.basename(install_name))) |
56 |
+ return (len(basename) < len(os.path.basename(install_name)) and \ |
57 |
+ basename.endswith(".dylib") and \ |
58 |
+ os.path.basename(install_name).startswith(basename[:-6]) |
59 |
|
60 |
def listLibraryObjects(self): |
61 |
""" |
62 |
@@ -490,8 +501,8 @@ class LinkageMapMachO(object): |
63 |
rValue = [] |
64 |
if not self._libs: |
65 |
self.rebuild() |
66 |
- for arch_map in self._libs.itervalues(): |
67 |
- for soname_map in arch_map.itervalues(): |
68 |
+ for arch_map in self._libs.values(): |
69 |
+ for soname_map in arch_map.values(): |
70 |
for obj_key in soname_map.providers: |
71 |
rValue.extend(self._obj_properties[obj_key][3]) |
72 |
return rValue |
73 |
@@ -620,7 +631,7 @@ class LinkageMapMachO(object): |
74 |
raise KeyError("%s (%s) not in object list" % (obj_key, obj)) |
75 |
|
76 |
# If there is another version of this lib with the |
77 |
- # same soname and the master link points to that |
78 |
+ # same soname and the install_name symlink points to that |
79 |
# other version, this lib will be shadowed and won't |
80 |
# have any consumers. |
81 |
if not isinstance(obj, self._ObjectKey): |