1 |
commit: 841a7a3228619b41a7f579f5090edd2bed5bfcac |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 26 17:27:55 2011 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 26 17:27:55 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=841a7a32 |
7 |
|
8 |
LinkageMapPeCoff: sync with LinkageMapELF |
9 |
|
10 |
--- |
11 |
pym/portage/util/_dyn_libs/LinkageMapPeCoff.py | 52 ++++++++++++++--------- |
12 |
1 files changed, 32 insertions(+), 20 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/util/_dyn_libs/LinkageMapPeCoff.py b/pym/portage/util/_dyn_libs/LinkageMapPeCoff.py |
15 |
index 25e8a45..0a42784 100644 |
16 |
--- a/pym/portage/util/_dyn_libs/LinkageMapPeCoff.py |
17 |
+++ b/pym/portage/util/_dyn_libs/LinkageMapPeCoff.py |
18 |
@@ -128,7 +128,7 @@ class LinkageMapPeCoff(LinkageMapELF): |
19 |
root = self._root |
20 |
root_len = len(root) - 1 |
21 |
self._clear_cache() |
22 |
- self._defpath.update(getlibpaths(self._root)) |
23 |
+ self._defpath.update(getlibpaths(self._root, env=self._dbapi.settings)) |
24 |
libs = self._libs |
25 |
obj_properties = self._obj_properties |
26 |
|
27 |
@@ -138,7 +138,7 @@ class LinkageMapPeCoff(LinkageMapELF): |
28 |
# overrides any data from previously installed files. |
29 |
if include_file is not None: |
30 |
for line in grabfile(include_file): |
31 |
- lines.append((include_file, line)) |
32 |
+ lines.append((None, include_file, line)) |
33 |
|
34 |
aux_keys = [self._needed_aux_key] |
35 |
can_lock = os.access(os.path.dirname(self._dbapi._dbroot), os.W_OK) |
36 |
@@ -151,16 +151,16 @@ class LinkageMapPeCoff(LinkageMapELF): |
37 |
needed_file = self._dbapi.getpath(cpv, |
38 |
filename=self._needed_aux_key) |
39 |
for line in self._dbapi.aux_get(cpv, aux_keys)[0].splitlines(): |
40 |
- lines.append((needed_file, line)) |
41 |
+ lines.append((cpv, needed_file, line)) |
42 |
finally: |
43 |
if can_lock: |
44 |
self._dbapi.unlock() |
45 |
|
46 |
# have to call readpecoff for preserved libs here as they aren't |
47 |
# registered in NEEDED.PECOFF.1 files |
48 |
- plibs = set() |
49 |
+ plibs = {} |
50 |
if preserve_paths is not None: |
51 |
- plibs.update(preserve_paths) |
52 |
+ plibs.update((x, None) for x in preserve_paths) |
53 |
if self._dbapi._plib_registry and \ |
54 |
self._dbapi._plib_registry.hasEntries(): |
55 |
for cpv, items in \ |
56 |
@@ -172,7 +172,7 @@ class LinkageMapPeCoff(LinkageMapELF): |
57 |
# already represented via the preserve_paths |
58 |
# parameter. |
59 |
continue |
60 |
- plibs.update(items) |
61 |
+ plibs.update((x, cpv) for x in items) |
62 |
if plibs: |
63 |
args = ["readpecoff", self._dbapi.settings.get('CHOST')] |
64 |
args.extend(os.path.join(root, x.lstrip("." + os.sep)) \ |
65 |
@@ -204,8 +204,8 @@ class LinkageMapPeCoff(LinkageMapELF): |
66 |
level=logging.ERROR, noiselevel=-1) |
67 |
continue |
68 |
fields[1] = fields[1][root_len:] |
69 |
- plibs.discard(fields[1]) |
70 |
- lines.append(("readpecoff", ";".join(fields))) |
71 |
+ owner = plibs.pop(fields[1], None) |
72 |
+ lines.append((owner, "readpecoff", ";".join(fields))) |
73 |
proc.wait() |
74 |
|
75 |
if plibs: |
76 |
@@ -215,10 +215,14 @@ class LinkageMapPeCoff(LinkageMapELF): |
77 |
# preserved library has an entry in self._obj_properties. This |
78 |
# is important in order to prevent findConsumers from raising |
79 |
# an unwanted KeyError. |
80 |
- for x in plibs: |
81 |
- lines.append(("plibs", ";".join(['', x, '', '', '']))) |
82 |
+ for x, cpv in plibs.items(): |
83 |
+ lines.append((cpv, "plibs", ";".join(['', x, '', '', '']))) |
84 |
|
85 |
- for location, l in lines: |
86 |
+ # Share identical frozenset instances when available, |
87 |
+ # in order to conserve memory. |
88 |
+ frozensets = {} |
89 |
+ |
90 |
+ for owner, location, l in lines: |
91 |
l = l.rstrip("\n") |
92 |
if not l: |
93 |
continue |
94 |
@@ -231,21 +235,24 @@ class LinkageMapPeCoff(LinkageMapELF): |
95 |
arch = fields[0] |
96 |
obj = fields[1] |
97 |
soname = fields[2] |
98 |
- path = set([normalize_path(x) \ |
99 |
+ path = frozenset(normalize_path(x) \ |
100 |
for x in filter(None, fields[3].replace( |
101 |
"${ORIGIN}", os.path.dirname(obj)).replace( |
102 |
- "$ORIGIN", os.path.dirname(obj)).split(":"))]) |
103 |
- needed = [x for x in fields[4].split(",") if x] |
104 |
+ "$ORIGIN", os.path.dirname(obj)).split(":"))) |
105 |
+ path = frozensets.setdefault(path, path) |
106 |
+ needed = frozenset(x for x in fields[4].split(",") if x) |
107 |
+ needed = frozensets.setdefault(needed, needed) |
108 |
|
109 |
obj_key = self._obj_key(obj) |
110 |
indexed = True |
111 |
myprops = obj_properties.get(obj_key) |
112 |
if myprops is None: |
113 |
indexed = False |
114 |
- myprops = (arch, needed, path, soname, set()) |
115 |
+ myprops = self._obj_properies_class( |
116 |
+ arch, needed, path, soname, [], owner) |
117 |
obj_properties[obj_key] = myprops |
118 |
# All object paths are added into the obj_properties tuple. |
119 |
- myprops[4].add(obj) |
120 |
+ myprops.alt_paths.append(obj) |
121 |
|
122 |
# Don't index the same file more that once since only one |
123 |
# set of data can be correct and therefore mixing data |
124 |
@@ -262,13 +269,18 @@ class LinkageMapPeCoff(LinkageMapELF): |
125 |
soname_map = arch_map.get(soname) |
126 |
if soname_map is None: |
127 |
soname_map = self._soname_map_class( |
128 |
- providers=set(), consumers=set()) |
129 |
+ providers=[], consumers=[]) |
130 |
arch_map[soname] = soname_map |
131 |
- soname_map.providers.add(obj_key) |
132 |
+ soname_map.providers.append(obj_key) |
133 |
for needed_soname in needed: |
134 |
soname_map = arch_map.get(needed_soname) |
135 |
if soname_map is None: |
136 |
soname_map = self._soname_map_class( |
137 |
- providers=set(), consumers=set()) |
138 |
+ providers=[], consumers=[]) |
139 |
arch_map[needed_soname] = soname_map |
140 |
- soname_map.consumers.add(obj_key) |
141 |
+ soname_map.consumers.append(obj_key) |
142 |
+ |
143 |
+ for arch, sonames in libs.items(): |
144 |
+ for soname_node in sonames.values(): |
145 |
+ soname_node.providers = tuple(set(soname_node.providers)) |
146 |
+ soname_node.consumers = tuple(set(soname_node.consumers)) |