1 |
Author: grobian |
2 |
Date: 2008-06-23 19:31:56 +0000 (Mon, 23 Jun 2008) |
3 |
New Revision: 10767 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/pym/_emerge/__init__.py |
7 |
main/branches/prefix/pym/portage/__init__.py |
8 |
main/branches/prefix/pym/portage/dbapi/vartree.py |
9 |
Log: |
10 |
Merged from trunk 10760:10764 |
11 |
|
12 |
| 10761 | Bug #228939 - Fix display list interaction with --tree mode | |
13 |
| zmedico | to prevent display of a duplicate list. | |
14 |
|
15 |
| 10762 | Bug #228977 - Protect against possible infinite loop in | |
16 |
| zmedico | dblink._preserve_libs(). | |
17 |
|
18 |
| 10763 | Bug #228935 - Add a new "command not found" build log QA | |
19 |
| zmedico | Notice. Thanks to Olivier Huber for the initial patch. | |
20 |
|
21 |
| 10764 | Bug #228977 - During dblink._preserve_libs() calls, cache | |
22 |
| zmedico | results of LinkageMap.findProviders(), | |
23 |
| | LinkageMap.findConsumers(), and os.path.realpath() calls in | |
24 |
| | order to improve performance. This makes a huge difference | |
25 |
| | in performance for glibc upgrades since glibc provides so | |
26 |
| | many libs to check consumerge for. | |
27 |
|
28 |
|
29 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
30 |
=================================================================== |
31 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-06-23 18:22:07 UTC (rev 10766) |
32 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-06-23 19:31:56 UTC (rev 10767) |
33 |
@@ -4436,7 +4436,10 @@ |
34 |
|
35 |
def _show_merge_list(self): |
36 |
if self._serialized_tasks_cache is not None and \ |
37 |
- self._serialized_tasks_cache != self._displayed_list: |
38 |
+ not (self._displayed_list and \ |
39 |
+ (self._displayed_list == self._serialized_tasks_cache or \ |
40 |
+ self._displayed_list == \ |
41 |
+ list(reversed(self._serialized_tasks_cache)))): |
42 |
display_list = self._serialized_tasks_cache[:] |
43 |
if "--tree" in self.myopts: |
44 |
display_list.reverse() |
45 |
|
46 |
Modified: main/branches/prefix/pym/portage/__init__.py |
47 |
=================================================================== |
48 |
--- main/branches/prefix/pym/portage/__init__.py 2008-06-23 18:22:07 UTC (rev 10766) |
49 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-06-23 19:31:56 UTC (rev 10767) |
50 |
@@ -4213,6 +4213,11 @@ |
51 |
pass |
52 |
else: |
53 |
am_maintainer_mode = [] |
54 |
+ |
55 |
+ bash_command_not_found = [] |
56 |
+ bash_command_not_found_re = re.compile( |
57 |
+ r'(.*): line (\d*): (.*): command not found$') |
58 |
+ |
59 |
configure_opts_warn = [] |
60 |
configure_opts_warn_re = re.compile( |
61 |
r'^configure: WARNING: Unrecognized options: .*') |
62 |
@@ -4224,6 +4229,10 @@ |
63 |
if am_maintainer_mode_re.search(line) is not None and \ |
64 |
am_maintainer_mode_exclude_re.search(line) is None: |
65 |
am_maintainer_mode.append(line.rstrip("\n")) |
66 |
+ |
67 |
+ if bash_command_not_found_re.match(line) is not None: |
68 |
+ bash_command_not_found.append(line.rstrip("\n")) |
69 |
+ |
70 |
if configure_opts_warn_re.match(line) is not None: |
71 |
configure_opts_warn.append(line.rstrip("\n")) |
72 |
finally: |
73 |
@@ -4254,6 +4263,12 @@ |
74 |
wrap_width)) |
75 |
_eqawarn(msg) |
76 |
|
77 |
+ if bash_command_not_found: |
78 |
+ msg = ["QA Notice: command not found:"] |
79 |
+ msg.append("") |
80 |
+ msg.extend("\t" + line for line in bash_command_not_found) |
81 |
+ _eqawarn(msg) |
82 |
+ |
83 |
if configure_opts_warn: |
84 |
msg = ["QA Notice: Unrecognized configure options:"] |
85 |
msg.append("") |
86 |
|
87 |
Modified: main/branches/prefix/pym/portage/dbapi/vartree.py |
88 |
=================================================================== |
89 |
--- main/branches/prefix/pym/portage/dbapi/vartree.py 2008-06-23 18:22:07 UTC (rev 10766) |
90 |
+++ main/branches/prefix/pym/portage/dbapi/vartree.py 2008-06-23 19:31:56 UTC (rev 10767) |
91 |
@@ -201,30 +201,48 @@ |
92 |
def findProviders(self, obj): |
93 |
if not self._libs: |
94 |
self.rebuild() |
95 |
+ |
96 |
+ realpath_cache = {} |
97 |
+ def realpath(p): |
98 |
+ real_path = realpath_cache.get(p) |
99 |
+ if real_path is None: |
100 |
+ real_path = os.path.realpath(p) |
101 |
+ realpath_cache[p] = real_path |
102 |
+ return real_path |
103 |
+ |
104 |
rValue = {} |
105 |
if obj not in self._obj_properties: |
106 |
- obj = os.path.realpath(obj) |
107 |
+ obj = realpath(obj) |
108 |
if obj not in self._obj_properties: |
109 |
raise KeyError("%s not in object list" % obj) |
110 |
arch, needed, path, soname = self._obj_properties[obj] |
111 |
path.extend(self._defpath) |
112 |
- path = [os.path.realpath(x) for x in path] |
113 |
+ path = set(realpath(x) for x in path) |
114 |
for x in needed: |
115 |
rValue[x] = set() |
116 |
if x not in self._libs or arch not in self._libs[x]: |
117 |
continue |
118 |
for y in self._libs[x][arch]["providers"]: |
119 |
- if x[0] == os.sep and os.path.realpath(x) == os.path.realpath(y): |
120 |
+ if x[0] == os.sep and realpath(x) == realpath(y): |
121 |
rValue[x].add(y) |
122 |
- elif os.path.realpath(os.path.dirname(y)) in path: |
123 |
+ elif realpath(os.path.dirname(y)) in path: |
124 |
rValue[x].add(y) |
125 |
return rValue |
126 |
|
127 |
def findConsumers(self, obj): |
128 |
if not self._libs: |
129 |
self.rebuild() |
130 |
+ |
131 |
+ realpath_cache = {} |
132 |
+ def realpath(p): |
133 |
+ real_path = realpath_cache.get(p) |
134 |
+ if real_path is None: |
135 |
+ real_path = os.path.realpath(p) |
136 |
+ realpath_cache[p] = real_path |
137 |
+ return real_path |
138 |
+ |
139 |
if obj not in self._obj_properties: |
140 |
- obj = os.path.realpath(obj) |
141 |
+ obj = realpath(obj) |
142 |
if obj not in self._obj_properties: |
143 |
raise KeyError("%s not in object list" % obj) |
144 |
rValue = set() |
145 |
@@ -233,10 +251,10 @@ |
146 |
if obj in self._libs[soname][arch]["providers"]: |
147 |
for x in self._libs[soname][arch]["consumers"]: |
148 |
path = self._obj_properties[x][2] |
149 |
- path = [os.path.realpath(y) for y in path+self._defpath] |
150 |
- if soname[0] == os.sep and os.path.realpath(soname) == os.path.realpath(obj): |
151 |
+ path = [realpath(y) for y in path+self._defpath] |
152 |
+ if soname[0] == os.sep and realpath(soname) == realpath(obj): |
153 |
rValue.add(x) |
154 |
- elif os.path.realpath(os.path.dirname(obj)) in path: |
155 |
+ elif realpath(os.path.dirname(obj)) in path: |
156 |
rValue.add(x) |
157 |
return rValue |
158 |
|
159 |
@@ -335,10 +353,19 @@ |
160 |
def findProviders(self, obj): |
161 |
if not self._libs: |
162 |
self.rebuild() |
163 |
+ |
164 |
+ realpath_cache = {} |
165 |
+ def realpath(p): |
166 |
+ real_path = realpath_cache.get(p) |
167 |
+ if real_path is None: |
168 |
+ real_path = os.path.realpath(p) |
169 |
+ realpath_cache[p] = real_path |
170 |
+ return real_path |
171 |
+ |
172 |
obj = os.path.normpath(obj) |
173 |
rValue = {} |
174 |
if obj not in self._obj_properties: |
175 |
- obj = os.path.realpath(obj) |
176 |
+ obj = realpath(obj) |
177 |
if obj not in self._obj_properties: |
178 |
raise KeyError("%s not in object list" % obj) |
179 |
needed, install_name = self._obj_properties[obj] |
180 |
@@ -348,13 +375,14 @@ |
181 |
if x not in self._libs: |
182 |
continue |
183 |
for y in self._libs[x]["providers"]: |
184 |
- if os.path.realpath(x) == os.path.realpath(y): |
185 |
+ if realpath(x) == realpath(y): |
186 |
rValue[x].add(y) |
187 |
return rValue |
188 |
|
189 |
def findConsumers(self, obj): |
190 |
if not self._libs: |
191 |
self.rebuild() |
192 |
+ |
193 |
obj = os.path.normpath(obj) |
194 |
if obj not in self._obj_properties: |
195 |
obj = os.path.realpath(obj) |
196 |
@@ -2128,9 +2156,15 @@ |
197 |
if os.path.islink(x) and os.path.realpath(x) in candidates and x not in mycontents: |
198 |
candidates.add(x) |
199 |
|
200 |
+ provider_cache = {} |
201 |
+ consumer_cache = {} |
202 |
+ |
203 |
# ignore any libs that are only internally used by the package |
204 |
def has_external_consumers(lib, contents, otherlibs): |
205 |
- consumers = linkmap.findConsumers(lib) |
206 |
+ consumers = consumer_cache.get(lib) |
207 |
+ if consumers is None: |
208 |
+ consumers = linkmap.findConsumers(lib) |
209 |
+ consumer_cache[lib] = consumers |
210 |
contents_without_libs = [x for x in contents if x not in otherlibs] |
211 |
|
212 |
# just used by objects that will be autocleaned |
213 |
@@ -2157,10 +2191,19 @@ |
214 |
continue |
215 |
# only preserve the lib if there is no other copy to use for each consumer |
216 |
keep = False |
217 |
- for c in linkmap.findConsumers(lib): |
218 |
+ |
219 |
+ lib_consumers = consumer_cache.get(lib) |
220 |
+ if lib_consumers is None: |
221 |
+ lib_consumers = linkmap.findConsumers(lib) |
222 |
+ consumer_cache[lib] = lib_consumers |
223 |
+ |
224 |
+ for c in lib_consumers: |
225 |
localkeep = True |
226 |
- providers = linkmap.findProviders(c) |
227 |
- |
228 |
+ providers = provider_cache.get(c) |
229 |
+ if providers is None: |
230 |
+ providers = linkmap.findProviders(c) |
231 |
+ provider_cache[c] = providers |
232 |
+ |
233 |
for soname in providers: |
234 |
if lib in providers[soname]: |
235 |
for p in providers[soname]: |
236 |
@@ -2201,8 +2244,9 @@ |
237 |
os.symlink(linktarget, os.path.join(srcroot, x.lstrip(os.sep))) |
238 |
if linktarget[0] != os.sep: |
239 |
linktarget = os.path.join(os.path.dirname(x), linktarget) |
240 |
- candidates.add(linktarget) |
241 |
- candidates_stack.append(linktarget) |
242 |
+ if linktarget not in candidates: |
243 |
+ candidates.add(linktarget) |
244 |
+ candidates_stack.append(linktarget) |
245 |
else: |
246 |
shutil.copy2(os.path.join(destroot, x.lstrip(os.sep)), |
247 |
os.path.join(srcroot, x.lstrip(os.sep))) |
248 |
|
249 |
-- |
250 |
gentoo-commits@l.g.o mailing list |