1 |
Author: grobian |
2 |
Date: 2008-10-11 15:49:30 +0000 (Sat, 11 Oct 2008) |
3 |
New Revision: 11675 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/doins |
7 |
main/branches/prefix/bin/ebuild.sh |
8 |
main/branches/prefix/bin/etc-update |
9 |
main/branches/prefix/pym/_emerge/__init__.py |
10 |
main/branches/prefix/pym/portage/__init__.py |
11 |
main/branches/prefix/pym/portage/exception.py |
12 |
main/branches/prefix/pym/portage/glsa.py |
13 |
Log: |
14 |
Merged from trunk -r11654:11673 |
15 |
|
16 |
| 11655 | Before returning config instances from | |
17 |
| zmedico | Scheduler._allocate_config(), call the config.reset() | |
18 |
| | method to make sure all settings from the previous package | |
19 |
| | get flushed out (such as PORTAGE_LOG_FILE). This fixes a | |
20 |
| | case where PORTAGE_LOG_FILE leaked from the previous | |
21 |
| | package to the clean phase of the next one, resulting in an | |
22 |
| | IOError due to the path being invalid and the parent | |
23 |
| | directory being nonexistent. | |
24 |
|
25 |
| 11656 | Since EbuildBuild no longer directs it's EbuildFetcher | |
26 |
| zmedico | instance's output to the global fetch log, there's no need | |
27 |
| | to schedule it on the fetch queue. | |
28 |
|
29 |
| 11657 | Use separate temp directories in order to avoid potential | |
30 |
| zmedico | name collisions. | |
31 |
|
32 |
| 11658 | In EbuildBuild._fetch_exit(), clean up the fetch log if | |
33 |
| zmedico | fetch was successful. | |
34 |
|
35 |
| 11659 | Fix apparent breakage from r11593 (slot dep support): * | |
36 |
| zmedico | Handle KeyError from element.getAttribute() in makeAtom() | |
37 |
| | and makeVersion(). * Avoid 'sre_constants.error: unmatched | |
38 |
| | group' exceptions in revisionMatch() when the atom does not | |
39 |
| | have a slot. | |
40 |
|
41 |
| 11660 | Don't show the repo display when the merge list is empty. | |
42 |
| zmedico | | |
43 |
|
44 |
| 11661 | In EbuildFetcher._set_returncode(), don't clean up | |
45 |
| zmedico | PORTAGE_BUILDDIR if keepwork or keeptemp are in FEATURES. | |
46 |
|
47 |
| 11664 | Bug #240684 - Fix _ebuild_arg_to_phase() to handle the | |
48 |
| zmedico | src_prepare phase so that the default() function is | |
49 |
| | properly created. | |
50 |
|
51 |
| 11665 | Fix code from previous commit so it properly checks $eapi | |
52 |
| zmedico | to verify that src_prepare is really a supported phase | |
53 |
| | function. | |
54 |
|
55 |
| 11666 | Remove redundant os.close(master_fd) call inside | |
56 |
| zmedico | SpawnProcess._start() since that file discriptor is | |
57 |
| | referenced by a file object which already has an | |
58 |
| | appropriate close() call. This fixes an 'IOError: [Errno 9] | |
59 |
| | Bad file descriptor' exception which was raised when | |
60 |
| | attempting to close the file object. | |
61 |
|
62 |
| 11667 | At the end of dyn_clean(), also remove the $CATEGORY | |
63 |
| zmedico | directory if possible. | |
64 |
|
65 |
| 11669 | Grab make.globals from GLOBAL_CONFIG_PATH if available and | |
66 |
| zmedico | fall back to the legacy location if necessary. | |
67 |
|
68 |
| 11670 | Create a new AmbiguousPackageName exception to raise from | |
69 |
| zmedico | portage.cpv_expand(). It inherits from ValueError, for | |
70 |
| | backward compatibility with calling code that already | |
71 |
| | handles ValueError. | |
72 |
|
73 |
| 11671 | Bug #241132 - Handle AmbiguousPackageName exceptions for | |
74 |
| zmedico | atoms passed to the --info action. | |
75 |
|
76 |
| 11672 | Migrate code from plain ValueError to AmbiguousPackageName | |
77 |
| zmedico | where appropriate (inherits from ValueError for backward | |
78 |
| | compatibility). | |
79 |
|
80 |
| 11673 | only use dummy echos in do_file() when running in | |
81 |
| SpankMan | interactive mode | |
82 |
|
83 |
|
84 |
Modified: main/branches/prefix/bin/doins |
85 |
=================================================================== |
86 |
--- main/branches/prefix/bin/doins 2008-10-11 15:44:10 UTC (rev 11674) |
87 |
+++ main/branches/prefix/bin/doins 2008-10-11 15:49:30 UTC (rev 11675) |
88 |
@@ -25,8 +25,9 @@ |
89 |
exit 1 |
90 |
fi |
91 |
|
92 |
-TMP=$T/.doins_tmp |
93 |
-mkdir "$TMP" |
94 |
+export TMP=$T/.doins_tmp |
95 |
+# Use separate directories to avoid potential name collisions. |
96 |
+mkdir -p "$TMP"/{1,2} |
97 |
|
98 |
if [[ ${INSDESTTREE#${EPREFIX}} != "${INSDESTTREE}" ]]; then |
99 |
vecho "-------------------------------------------------------" 1>&2 |
100 |
@@ -42,8 +43,8 @@ |
101 |
local mysrc="$1" mydir="$2" cleanup="" rval |
102 |
|
103 |
if [ -L "$mysrc" ] ; then |
104 |
- cp "$mysrc" "$TMP" |
105 |
- mysrc="$TMP/${mysrc##*/}" |
106 |
+ cp "$mysrc" "$TMP/2" |
107 |
+ mysrc="$TMP/2/${mysrc##*/}" |
108 |
cleanup=${mysrc} |
109 |
fi |
110 |
|
111 |
@@ -85,14 +86,14 @@ |
112 |
pushd "${PWD%/*}" >/dev/null |
113 |
done |
114 |
if [[ $x != $x_orig ]] ; then |
115 |
- mv "$x" "$TMP/$x_orig" |
116 |
- pushd "$TMP" >/dev/null |
117 |
+ mv "$x" "$TMP/1/$x_orig" |
118 |
+ pushd "$TMP/1" >/dev/null |
119 |
fi |
120 |
find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; |
121 |
find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins |
122 |
if [[ $x != $x_orig ]] ; then |
123 |
popd >/dev/null |
124 |
- mv "$TMP/$x_orig" "$x" |
125 |
+ mv "$TMP/1/$x_orig" "$x" |
126 |
fi |
127 |
while popd >/dev/null 2>&1 ; do true ; done |
128 |
((++success)) |
129 |
|
130 |
Modified: main/branches/prefix/bin/ebuild.sh |
131 |
=================================================================== |
132 |
--- main/branches/prefix/bin/ebuild.sh 2008-10-11 15:44:10 UTC (rev 11674) |
133 |
+++ main/branches/prefix/bin/ebuild.sh 2008-10-11 15:49:30 UTC (rev 11675) |
134 |
@@ -762,8 +762,8 @@ |
135 |
|
136 |
# Some kernels, such as Solaris, return EINVAL when an attempt |
137 |
# is made to remove the current working directory. |
138 |
- cd "$PORTAGE_BUILDDIR"/.. |
139 |
- rmdir "$PORTAGE_BUILDDIR" 2>/dev/null |
140 |
+ cd "$PORTAGE_BUILDDIR"/../.. |
141 |
+ rmdir "$PORTAGE_BUILDDIR" "${PORTAGE_BUILDDIR%/*}" 2>/dev/null |
142 |
|
143 |
true |
144 |
} |
145 |
@@ -1405,6 +1405,10 @@ |
146 |
unpack) |
147 |
phase_func=src_unpack |
148 |
;; |
149 |
+ prepare) |
150 |
+ ! hasq $eapi 0 1 2_pre1 2_pre2 && \ |
151 |
+ phase_func=src_prepare |
152 |
+ ;; |
153 |
configure) |
154 |
! hasq $eapi 0 1 2_pre1 && \ |
155 |
phase_func=src_configure |
156 |
|
157 |
Modified: main/branches/prefix/bin/etc-update |
158 |
=================================================================== |
159 |
--- main/branches/prefix/bin/etc-update 2008-10-11 15:44:10 UTC (rev 11674) |
160 |
+++ main/branches/prefix/bin/etc-update 2008-10-11 15:49:30 UTC (rev 11675) |
161 |
@@ -227,7 +227,8 @@ |
162 |
} |
163 |
|
164 |
do_file() { |
165 |
- echo |
166 |
+ interactive_echo() { [ "${OVERWRITE_ALL}" != "yes" ] && [ "${DELETE_ALL}" != "yes" ] && echo; } |
167 |
+ interactive_echo |
168 |
local -i my_input |
169 |
local -i fcount=0 |
170 |
until (( $(wc -l < ${TMP}/files/${input}) < 2 )); do |
171 |
@@ -296,7 +297,7 @@ |
172 |
break |
173 |
fi |
174 |
done |
175 |
- echo |
176 |
+ interactive_echo |
177 |
rm ${TMP}/files/${input} |
178 |
count=${count}-1 |
179 |
} |
180 |
|
181 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
182 |
=================================================================== |
183 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-10-11 15:44:10 UTC (rev 11674) |
184 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-10-11 15:49:30 UTC (rev 11675) |
185 |
@@ -2169,7 +2169,6 @@ |
186 |
|
187 |
if isinstance(retval, int): |
188 |
# spawn failed |
189 |
- os.close(master_fd) |
190 |
for f in files.values(): |
191 |
f.close() |
192 |
self.returncode = retval |
193 |
@@ -2322,7 +2321,9 @@ |
194 |
elog_out.close() |
195 |
if not self.prefetch: |
196 |
portage.elog.elog_process(self.pkg.cpv, self._build_dir.settings) |
197 |
- if self.fetchonly or self.returncode == os.EX_OK: |
198 |
+ features = self._build_dir.settings.features |
199 |
+ if (self.fetchonly or self.returncode == os.EX_OK) and \ |
200 |
+ not ("keepwork" in features or "keeptemp" in features): |
201 |
try: |
202 |
shutil.rmtree(self._build_dir.settings["PORTAGE_BUILDDIR"]) |
203 |
except EnvironmentError, e: |
204 |
@@ -2474,20 +2475,13 @@ |
205 |
self.wait() |
206 |
return |
207 |
|
208 |
- fetch_log = None |
209 |
- |
210 |
fetcher = EbuildFetcher(config_pool=self.config_pool, |
211 |
fetchall=opts.fetch_all_uri, |
212 |
fetchonly=opts.fetchonly, |
213 |
- background=self.background, logfile=fetch_log, |
214 |
+ background=self.background, |
215 |
pkg=pkg, scheduler=self.scheduler) |
216 |
|
217 |
- if self.background: |
218 |
- fetcher.addExitListener(self._fetch_exit) |
219 |
- self._current_task = fetcher |
220 |
- self.scheduler.fetch.schedule(fetcher) |
221 |
- else: |
222 |
- self._start_task(fetcher, self._fetch_exit) |
223 |
+ self._start_task(fetcher, self._fetch_exit) |
224 |
|
225 |
def _fetch_exit(self, fetcher): |
226 |
opts = self.opts |
227 |
@@ -2503,6 +2497,13 @@ |
228 |
os.path.exists(fetcher.logfile): |
229 |
self.settings["PORTAGE_LOG_FILE"] = fetcher.logfile |
230 |
|
231 |
+ if not fetch_failed and fetcher.logfile is not None: |
232 |
+ # Fetch was successful, so remove the fetch log. |
233 |
+ try: |
234 |
+ os.unlink(fetcher.logfile) |
235 |
+ except OSError: |
236 |
+ pass |
237 |
+ |
238 |
if fetch_failed or opts.fetchonly: |
239 |
self.wait() |
240 |
return |
241 |
@@ -4757,10 +4758,7 @@ |
242 |
|
243 |
if debug: |
244 |
print "Exiting...", jbigkey |
245 |
- except ValueError, e: |
246 |
- if not e.args or not isinstance(e.args[0], list) or \ |
247 |
- len(e.args[0]) < 2: |
248 |
- raise |
249 |
+ except portage.exception.AmbiguousPackageName, e: |
250 |
pkgs = e.args[0] |
251 |
portage.writemsg("\n\n!!! An atom in the dependencies " + \ |
252 |
"is not fully-qualified. Multiple matches:\n\n", noiselevel=-1) |
253 |
@@ -7507,7 +7505,7 @@ |
254 |
p.append(colorize("WARN", " then resume the merge.")) |
255 |
|
256 |
out = sys.stdout |
257 |
- show_repos = repoadd_set != set(["0"]) |
258 |
+ show_repos = repoadd_set and repoadd_set != set(["0"]) |
259 |
|
260 |
for x in p: |
261 |
if isinstance(x, basestring): |
262 |
@@ -8066,8 +8064,8 @@ |
263 |
expanded_atoms = non_virtual_atoms |
264 |
if len(expanded_atoms) > 1: |
265 |
# compatible with portage.cpv_expand() |
266 |
- raise ValueError([portage.dep_getkey(x) \ |
267 |
- for x in expanded_atoms]) |
268 |
+ raise portage.exception.AmbiguousPackageName( |
269 |
+ [portage.dep_getkey(x) for x in expanded_atoms]) |
270 |
if expanded_atoms: |
271 |
atom = expanded_atoms[0] |
272 |
else: |
273 |
@@ -9970,6 +9968,10 @@ |
274 |
temp_settings = self._config_pool[root].pop() |
275 |
else: |
276 |
temp_settings = portage.config(clone=self.pkgsettings[root]) |
277 |
+ # Since config.setcpv() isn't guaranteed to call config.reset() due to |
278 |
+ # performance reasons, call it here to make sure all settings from the |
279 |
+ # previous package get flushed out (such as PORTAGE_LOG_FILE). |
280 |
+ temp_settings.reset() |
281 |
return temp_settings |
282 |
|
283 |
def _deallocate_config(self, settings): |
284 |
@@ -10593,7 +10595,7 @@ |
285 |
# what will and will not get unmerged |
286 |
try: |
287 |
mymatch = vartree.dbapi.match(x) |
288 |
- except ValueError, errpkgs: |
289 |
+ except portage.exception.AmbiguousPackageName, errpkgs: |
290 |
print "\n\n!!! The short ebuild name \"" + \ |
291 |
x + "\" is ambiguous. Please specify" |
292 |
print "!!! one of the following fully-qualified " + \ |
293 |
@@ -11867,7 +11869,7 @@ |
294 |
print |
295 |
try: |
296 |
pkgs = trees[settings["ROOT"]]["vartree"].dbapi.match(myfiles[0]) |
297 |
- except ValueError, e: |
298 |
+ except portage.exception.AmbiguousPackageName, e: |
299 |
# Multiple matches thrown from cpv_expand |
300 |
pkgs = e.args[0] |
301 |
if len(pkgs) == 0: |
302 |
@@ -12200,7 +12202,7 @@ |
303 |
return |
304 |
try: |
305 |
atom = portage.dep_expand(x, mydb=vardb, settings=settings) |
306 |
- except ValueError, e: |
307 |
+ except portage.exception.AmbiguousPackageName, e: |
308 |
msg = "The short ebuild name \"" + x + \ |
309 |
"\" is ambiguous. Please specify " + \ |
310 |
"one of the following " + \ |
311 |
@@ -14068,10 +14070,6 @@ |
312 |
elif "config"==myaction: |
313 |
validate_ebuild_environment(trees) |
314 |
action_config(settings, trees, myopts, myfiles) |
315 |
- |
316 |
- # INFO action |
317 |
- elif "info"==myaction: |
318 |
- action_info(settings, trees, myopts, myfiles) |
319 |
|
320 |
# SEARCH action |
321 |
elif "search"==myaction: |
322 |
@@ -14103,7 +14101,7 @@ |
323 |
if not (buildpkgonly or fetchonly or pretend): |
324 |
post_emerge(root_config, myopts, mtimedb, os.EX_OK) |
325 |
|
326 |
- elif myaction in ("depclean", "prune"): |
327 |
+ elif myaction in ("depclean", "info", "prune"): |
328 |
|
329 |
# Ensure atoms are valid before calling unmerge(). |
330 |
vardb = trees[settings["ROOT"]]["vartree"].dbapi |
331 |
@@ -14113,7 +14111,7 @@ |
332 |
try: |
333 |
valid_atoms.append( |
334 |
portage.dep_expand(x, mydb=vardb, settings=settings)) |
335 |
- except ValueError, e: |
336 |
+ except portage.exception.AmbiguousPackageName, e: |
337 |
msg = "The short ebuild name \"" + x + \ |
338 |
"\" is ambiguous. Please specify " + \ |
339 |
"one of the following " + \ |
340 |
@@ -14134,6 +14132,9 @@ |
341 |
level=logging.ERROR, noiselevel=-1) |
342 |
return 1 |
343 |
|
344 |
+ if myaction == "info": |
345 |
+ return action_info(settings, trees, myopts, valid_atoms) |
346 |
+ |
347 |
validate_ebuild_environment(trees) |
348 |
action_depclean(settings, trees, mtimedb["ldpath"], |
349 |
myopts, myaction, valid_atoms, spinner) |
350 |
|
351 |
Modified: main/branches/prefix/pym/portage/__init__.py |
352 |
=================================================================== |
353 |
--- main/branches/prefix/pym/portage/__init__.py 2008-10-11 15:44:10 UTC (rev 11674) |
354 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-10-11 15:49:30 UTC (rev 11675) |
355 |
@@ -1350,8 +1350,11 @@ |
356 |
|
357 |
# make.globals should not be relative to config_root |
358 |
# because it only contains constants. |
359 |
- self.mygcfg = getconfig(os.path.join(BPREFIX, "etc", "make.globals"), |
360 |
- expand=expand_map) |
361 |
+ for x in (portage.const.GLOBAL_CONFIG_PATH, BPREFIX+"/etc"): |
362 |
+ self.mygcfg = getconfig(os.path.join(x, "make.globals"), |
363 |
+ expand=expand_map) |
364 |
+ if self.mygcfg: |
365 |
+ break |
366 |
|
367 |
if self.mygcfg is None: |
368 |
self.mygcfg = {} |
369 |
@@ -6662,7 +6665,10 @@ |
370 |
else: |
371 |
virtual_name_collision = True |
372 |
if not virtual_name_collision: |
373 |
- raise ValueError, matches |
374 |
+ # AmbiguousPackageName inherits from ValueError, |
375 |
+ # for backward compatibility with calling code |
376 |
+ # that already handles ValueError. |
377 |
+ raise portage.exception.AmbiguousPackageName(matches) |
378 |
elif matches: |
379 |
mykey=matches[0] |
380 |
|
381 |
|
382 |
Modified: main/branches/prefix/pym/portage/exception.py |
383 |
=================================================================== |
384 |
--- main/branches/prefix/pym/portage/exception.py 2008-10-11 15:44:10 UTC (rev 11674) |
385 |
+++ main/branches/prefix/pym/portage/exception.py 2008-10-11 15:49:30 UTC (rev 11675) |
386 |
@@ -67,6 +67,13 @@ |
387 |
class CommandNotFound(PortageException): |
388 |
"""A required binary was not available or executable""" |
389 |
|
390 |
+class AmbiguousPackageName(ValueError, PortageException): |
391 |
+ """Raised by portage.cpv_expand() when the package name is ambiguous due |
392 |
+ to the existence of multiple matches in different categories. This inherits |
393 |
+ from ValueError, for backward compatibility with calling code that already |
394 |
+ handles ValueError.""" |
395 |
+ def __str__(self): |
396 |
+ return ValueError.__str__(self) |
397 |
|
398 |
class PortagePackageException(PortageException): |
399 |
"""Malformed or missing package data""" |
400 |
|
401 |
Modified: main/branches/prefix/pym/portage/glsa.py |
402 |
=================================================================== |
403 |
--- main/branches/prefix/pym/portage/glsa.py 2008-10-11 15:44:10 UTC (rev 11674) |
404 |
+++ main/branches/prefix/pym/portage/glsa.py 2008-10-11 15:49:30 UTC (rev 11675) |
405 |
@@ -226,8 +226,13 @@ |
406 |
rValue = opMapping[versionNode.getAttribute("range")] \ |
407 |
+ pkgname \ |
408 |
+ "-" + getText(versionNode, format="strip") |
409 |
- if "slot" in versionNode.attributes and versionNode.getAttribute("slot") != "*": |
410 |
- rValue += ":"+versionNode.getAttribute("slot") |
411 |
+ try: |
412 |
+ slot = versionNode.getAttribute("slot").strip() |
413 |
+ except KeyError: |
414 |
+ pass |
415 |
+ else: |
416 |
+ if slot and slot != "*": |
417 |
+ rValue += ":" + slot |
418 |
return str(rValue) |
419 |
|
420 |
def makeVersion(versionNode): |
421 |
@@ -243,8 +248,13 @@ |
422 |
""" |
423 |
rValue = opMapping[versionNode.getAttribute("range")] \ |
424 |
+ getText(versionNode, format="strip") |
425 |
- if "slot" in versionNode.attributes and versionNode.getAttribute("slot") != "*": |
426 |
- rValue += ":"+versionNode.getAttribute("slot") |
427 |
+ try: |
428 |
+ slot = versionNode.getAttribute("slot").strip() |
429 |
+ except KeyError: |
430 |
+ pass |
431 |
+ else: |
432 |
+ if slot and slot != "*": |
433 |
+ rValue += ":" + slot |
434 |
return rValue |
435 |
|
436 |
def match(atom, dbapi, match_type="default"): |
437 |
@@ -288,9 +298,15 @@ |
438 |
@return: a list with the matching versions |
439 |
""" |
440 |
if match_type == "default" or not hasattr(dbapi, "xmatch"): |
441 |
- mylist = dbapi.match(re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:])) |
442 |
+ if ":" in revisionAtom: |
443 |
+ mylist = dbapi.match(re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:])) |
444 |
+ else: |
445 |
+ mylist = dbapi.match(re.sub("-r[0-9]+$", "", revisionAtom[2:])) |
446 |
else: |
447 |
- mylist = dbapi.xmatch(match_type, re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:])) |
448 |
+ if ":" in revisionAtom: |
449 |
+ mylist = dbapi.xmatch(match_type, re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:])) |
450 |
+ else: |
451 |
+ mylist = dbapi.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:])) |
452 |
rValue = [] |
453 |
for v in mylist: |
454 |
r1 = pkgsplit(v)[-1][1:] |