1 |
Author: grobian |
2 |
Date: 2008-09-27 15:53:48 +0000 (Sat, 27 Sep 2008) |
3 |
New Revision: 11568 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/ebuild.sh |
7 |
main/branches/prefix/bin/isolated-functions.sh |
8 |
main/branches/prefix/bin/misc-functions.sh |
9 |
main/branches/prefix/doc/package/ebuild/eapi/2.docbook |
10 |
main/branches/prefix/man/make.conf.5 |
11 |
main/branches/prefix/pym/_emerge/__init__.py |
12 |
main/branches/prefix/pym/portage/__init__.py |
13 |
main/branches/prefix/pym/portage/news.py |
14 |
main/branches/prefix/pym/portage/update.py |
15 |
Log: |
16 |
Merged from trunk -r11505:11515 |
17 |
|
18 |
| 11506 | Document FEATURES=preserve-libs. | |
19 |
| zmedico | | |
20 |
|
21 |
| 11508 | Move the world file update code out of update_config_files() | |
22 |
| zmedico | since it should not be relative to PORTAGE_CONFIGROOT. | |
23 |
| | Thanks to grobian for reporting. | |
24 |
|
25 |
| 11509 | Define __all__ and remove unused imports found by pyflakes. | |
26 |
| zmedico | | |
27 |
|
28 |
| 11510 | Bug #237526 - Use portage.util.grablines() for exception | |
29 |
| zmedico | handling when reading the unread file. | |
30 |
|
31 |
| 11511 | Fix PYTHONPATH adjustments to only insert a colon when | |
32 |
| zmedico | necessary. This is necessary since having a stray colon | |
33 |
| | causes python to interpret the empty path entry as "." which | |
34 |
| | triggers the following message if cwd happens to contain a | |
35 |
| | directory names "os": warning: Not importing directory 'os': | |
36 |
| | missing __init__.py Thanks to Joe Peterson <lavajoe@g.o> for | |
37 |
| | reporting. | |
38 |
|
39 |
| 11512 | Remove unneeded quotes from PYTHONPATH assignments and also | |
40 |
| zmedico | fix one more potential redundant colon inside | |
41 |
| | misc-functions.sh. | |
42 |
|
43 |
| 11513 | Improve error messages for issues with the SYNC variable | |
44 |
| zmedico | inside action_sync(). | |
45 |
|
46 |
| 11514 | Fix broken reference to self.files inside | |
47 |
| zmedico | SpawnProcess._start(). | |
48 |
|
49 |
| 11515 | Remove everything related to the eapi* default phase | |
50 |
| zmedico | functions since they are not included in the current EAPI 2 | |
51 |
| | draft. | |
52 |
|
53 |
|
54 |
Modified: main/branches/prefix/bin/ebuild.sh |
55 |
=================================================================== |
56 |
--- main/branches/prefix/bin/ebuild.sh 2008-09-27 15:38:53 UTC (rev 11567) |
57 |
+++ main/branches/prefix/bin/ebuild.sh 2008-09-27 15:53:48 UTC (rev 11568) |
58 |
@@ -166,7 +166,7 @@ |
59 |
fi |
60 |
# return shell-true/shell-false if exists. |
61 |
# Takes single depend-type atoms. |
62 |
- PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \ |
63 |
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
64 |
"${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1" |
65 |
local retval=$? |
66 |
case "${retval}" in |
67 |
@@ -186,7 +186,7 @@ |
68 |
if [ "${EBUILD_PHASE}" == "depend" ]; then |
69 |
die "portageq calls are not allowed in the global scope" |
70 |
fi |
71 |
- PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \ |
72 |
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
73 |
"${PORTAGE_BIN_PATH}/portageq" "$@" |
74 |
} |
75 |
|
76 |
@@ -202,7 +202,7 @@ |
77 |
fi |
78 |
# returns the best/most-current match. |
79 |
# Takes single depend-type atoms. |
80 |
- PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \ |
81 |
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
82 |
"${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1" |
83 |
local retval=$? |
84 |
case "${retval}" in |
85 |
@@ -1458,11 +1458,6 @@ |
86 |
eval "default_$x() { |
87 |
die \"default_$x() is not supported with EAPI='$eapi' during phase $phase_func\" |
88 |
}" |
89 |
- for y in 0 1 2 ; do |
90 |
- eval "eapi${y}_$x() { |
91 |
- die \"eapi${y}_$x() is not supported with EAPI='$eapi' during phase $phase_func\" |
92 |
- }" |
93 |
- done |
94 |
done |
95 |
|
96 |
eval "default() { |
97 |
@@ -1481,35 +1476,17 @@ |
98 |
|
99 |
if hasq $phase_func $default_phases ; then |
100 |
|
101 |
- eapi0_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; } |
102 |
- eapi0_src_unpack () { _eapi0_src_unpack "$@" ; } |
103 |
- eapi0_src_prepare () { die "$FUNCNAME is not supported" ; } |
104 |
- eapi0_src_configure () { die "$FUNCNAME is not supported" ; } |
105 |
- eapi0_src_compile () { _eapi0_src_compile "$@" ; } |
106 |
- eapi0_src_test () { _eapi0_src_test "$@" ; } |
107 |
- eapi0_src_install () { die "$FUNCNAME is not supported" ; } |
108 |
+ _eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; } |
109 |
+ _eapi2_src_unpack () { _eapi0_src_unpack "$@" ; } |
110 |
+ _eapi2_src_prepare () { true ; } |
111 |
+ _eapi2_src_test () { _eapi0_src_test "$@" ; } |
112 |
+ _eapi2_src_install () { die "$FUNCNAME is not supported" ; } |
113 |
|
114 |
- eapi1_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; } |
115 |
- eapi1_src_unpack () { _eapi0_src_unpack "$@" ; } |
116 |
- eapi1_src_prepare () { die "$FUNCNAME is not supported" ; } |
117 |
- eapi1_src_configure () { die "$FUNCNAME is not supported" ; } |
118 |
- eapi1_src_compile () { _eapi1_src_compile "$@" ; } |
119 |
- eapi1_src_test () { _eapi0_src_test "$@" ; } |
120 |
- eapi1_src_install () { die "$FUNCNAME is not supported" ; } |
121 |
- |
122 |
- eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; } |
123 |
- eapi2_src_unpack () { _eapi0_src_unpack "$@" ; } |
124 |
- eapi2_src_prepare () { true ; } |
125 |
- eapi2_src_configure () { _eapi2_src_configure "$@" ; } |
126 |
- eapi2_src_compile () { _eapi2_src_compile "$@" ; } |
127 |
- eapi2_src_test () { _eapi0_src_test "$@" ; } |
128 |
- eapi2_src_install () { die "$FUNCNAME is not supported" ; } |
129 |
- |
130 |
for x in $default_phases ; do |
131 |
- eval "default_$x() { eapi2_$x \"\$@\" ; }" |
132 |
+ eval "default_$x() { _eapi2_$x \"\$@\" ; }" |
133 |
done |
134 |
|
135 |
- eval "default() { eapi2_$phase_func \"\$@\" ; }" |
136 |
+ eval "default() { _eapi2_$phase_func \"\$@\" ; }" |
137 |
|
138 |
else |
139 |
|
140 |
@@ -1517,11 +1494,6 @@ |
141 |
eval "default_$x() { |
142 |
die \"default_$x() is not supported in phase $default_func\" |
143 |
}" |
144 |
- for y in 0 1 2 ; do |
145 |
- eval "eapi${y}_$x() { |
146 |
- die \"eapi${y}_$x() is not supported with EAPI='$eapi' during phase $phase_func\" |
147 |
- }" |
148 |
- done |
149 |
done |
150 |
|
151 |
eval "default() { |
152 |
|
153 |
Modified: main/branches/prefix/bin/isolated-functions.sh |
154 |
=================================================================== |
155 |
--- main/branches/prefix/bin/isolated-functions.sh 2008-09-27 15:38:53 UTC (rev 11567) |
156 |
+++ main/branches/prefix/bin/isolated-functions.sh 2008-09-27 15:53:48 UTC (rev 11568) |
157 |
@@ -561,7 +561,7 @@ |
158 |
for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \ |
159 |
src_compile src_test src_install pkg_preinst pkg_postinst \ |
160 |
pkg_prerm pkg_postrm ; do |
161 |
- unset -f {,_}default_$x {,_}eapi{0,1,2}_$x |
162 |
+ unset -f _default_$x _eapi{0,1,2}_$x |
163 |
done |
164 |
unset x |
165 |
|
166 |
|
167 |
Modified: main/branches/prefix/bin/misc-functions.sh |
168 |
=================================================================== |
169 |
--- main/branches/prefix/bin/misc-functions.sh 2008-09-27 15:38:53 UTC (rev 11567) |
170 |
+++ main/branches/prefix/bin/misc-functions.sh 2008-09-27 15:53:48 UTC (rev 11568) |
171 |
@@ -749,7 +749,7 @@ |
172 |
tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \ |
173 |
bzip2 -f > "$PORTAGE_BINPKG_TMPFILE" || \ |
174 |
die "Failed to create tarball" |
175 |
- export PYTHONPATH=${PORTAGE_PYM_PATH:-${EPREFIX}/usr/lib/portage/pym} |
176 |
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
177 |
python -c "from portage import xpak; t=xpak.tbz2('${PORTAGE_BINPKG_TMPFILE}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')" |
178 |
if [ $? -ne 0 ]; then |
179 |
rm -f "${PORTAGE_BINPKG_TMPFILE}" |
180 |
|
181 |
Modified: main/branches/prefix/doc/package/ebuild/eapi/2.docbook |
182 |
=================================================================== |
183 |
--- main/branches/prefix/doc/package/ebuild/eapi/2.docbook 2008-09-27 15:38:53 UTC (rev 11567) |
184 |
+++ main/branches/prefix/doc/package/ebuild/eapi/2.docbook 2008-09-27 15:53:48 UTC (rev 11568) |
185 |
@@ -203,64 +203,6 @@ |
186 |
</tbody> |
187 |
</tgroup> |
188 |
</table> |
189 |
- <para> |
190 |
- The default phase functions for a particular EAPI are also |
191 |
- accessible as functions having names that start with 'eapi' |
192 |
- followed by the EAPI value. For example, a call to a function |
193 |
- named eapi0_src_compile is equivalent to a call to the |
194 |
- default src_compile implementation that is provided with EAPI 0. |
195 |
- </para> |
196 |
- <table><title>Default EAPI Phase Functions</title> |
197 |
- <tgroup cols='1' align='left' > |
198 |
- <colspec colname='name'/> |
199 |
- <thead> |
200 |
- <row> |
201 |
- <entry>Function Name</entry> |
202 |
- </row> |
203 |
- </thead> |
204 |
- <tbody> |
205 |
- <row> |
206 |
- <entry>eapi0_pkg_nofetch</entry> |
207 |
- </row> |
208 |
- <row> |
209 |
- <entry>eapi0_src_unpack</entry> |
210 |
- </row> |
211 |
- <row> |
212 |
- <entry>eapi0_src_compile</entry> |
213 |
- </row> |
214 |
- <row> |
215 |
- <entry>eapi0_src_test</entry> |
216 |
- </row> |
217 |
- <row> |
218 |
- <entry>eapi1_pkg_nofetch</entry> |
219 |
- </row> |
220 |
- <row> |
221 |
- <entry>eapi1_src_unpack</entry> |
222 |
- </row> |
223 |
- <row> |
224 |
- <entry>eapi1_src_compile</entry> |
225 |
- </row> |
226 |
- <row> |
227 |
- <entry>eapi1_src_test</entry> |
228 |
- </row> |
229 |
- <row> |
230 |
- <entry>eapi2_pkg_nofetch</entry> |
231 |
- </row> |
232 |
- <row> |
233 |
- <entry>eapi2_src_unpack</entry> |
234 |
- </row> |
235 |
- <row> |
236 |
- <entry>eapi2_src_configure</entry> |
237 |
- </row> |
238 |
- <row> |
239 |
- <entry>eapi2_src_compile</entry> |
240 |
- </row> |
241 |
- <row> |
242 |
- <entry>eapi2_src_test</entry> |
243 |
- </row> |
244 |
- </tbody> |
245 |
- </tgroup> |
246 |
- </table> |
247 |
</section> |
248 |
<section id='package-ebuild-eapi-2-phases-default-function-alias'> |
249 |
<title>Default Phase Function Alias</title> |
250 |
|
251 |
Modified: main/branches/prefix/man/make.conf.5 |
252 |
=================================================================== |
253 |
--- main/branches/prefix/man/make.conf.5 2008-09-27 15:38:53 UTC (rev 11567) |
254 |
+++ main/branches/prefix/man/make.conf.5 2008-09-27 15:53:48 UTC (rev 11568) |
255 |
@@ -269,6 +269,10 @@ |
256 |
`tail \-f /var/log/emerge\-fetch.log` in a |
257 |
terminal to view parallel-fetch progress. |
258 |
.TP |
259 |
+.B preserve\-libs |
260 |
+Preserve libraries when the sonames change during upgrade or downgrade. |
261 |
+Libraries are preserved only if consumers of those libraries are detected. |
262 |
+.TP |
263 |
.B protect\-owned |
264 |
This is identical to the \fIcollision\-protect\fR feature except that files |
265 |
may be overwritten if they are not explicitly listed in the contents of a |
266 |
|
267 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
268 |
=================================================================== |
269 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-09-27 15:38:53 UTC (rev 11567) |
270 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-09-27 15:53:48 UTC (rev 11568) |
271 |
@@ -2160,7 +2160,7 @@ |
272 |
if isinstance(retval, int): |
273 |
# spawn failed |
274 |
os.close(master_fd) |
275 |
- for f in self.files.values(): |
276 |
+ for f in files.values(): |
277 |
f.close() |
278 |
self.returncode = retval |
279 |
self.wait() |
280 |
@@ -11120,7 +11120,12 @@ |
281 |
if not os.path.exists(myportdir): |
282 |
print ">>>",myportdir,"not found, creating it." |
283 |
os.makedirs(myportdir,0755) |
284 |
- syncuri=settings["SYNC"].rstrip() |
285 |
+ syncuri = settings.get("SYNC", "").strip() |
286 |
+ if not syncuri: |
287 |
+ writemsg_level("!!! SYNC is undefined. Is /etc/make.globals missing?\n", |
288 |
+ noiselevel=-1, level=logging.ERROR) |
289 |
+ return 1 |
290 |
+ |
291 |
os.umask(0022) |
292 |
updatecache_flg = False |
293 |
if myaction == "metadata": |
294 |
@@ -11571,8 +11576,9 @@ |
295 |
|
296 |
dosyncuri = syncuri |
297 |
else: |
298 |
- print "!!! rsync setting: ",syncuri,"not recognized; exiting." |
299 |
- sys.exit(1) |
300 |
+ writemsg_level("!!! Unrecognized protocol: SYNC='%s'\n" % (syncuri,), |
301 |
+ noiselevel=-1, level=logging.ERROR) |
302 |
+ return 1 |
303 |
|
304 |
if updatecache_flg and \ |
305 |
myaction != "metadata" and \ |
306 |
@@ -11617,6 +11623,7 @@ |
307 |
print |
308 |
|
309 |
display_news_notification(root_config, myopts) |
310 |
+ return os.EX_OK |
311 |
|
312 |
def action_metadata(settings, portdb, myopts): |
313 |
portage.writemsg_stdout("\n>>> Updating Portage cache: ") |
314 |
@@ -13836,7 +13843,7 @@ |
315 |
root_config = trees[settings["ROOT"]]["root_config"] |
316 |
|
317 |
if "sync" == myaction: |
318 |
- action_sync(settings, trees, mtimedb, myopts, myaction) |
319 |
+ return action_sync(settings, trees, mtimedb, myopts, myaction) |
320 |
elif "metadata" == myaction: |
321 |
action_metadata(settings, portdb, myopts) |
322 |
elif myaction=="regen": |
323 |
|
324 |
Modified: main/branches/prefix/pym/portage/__init__.py |
325 |
=================================================================== |
326 |
--- main/branches/prefix/pym/portage/__init__.py 2008-09-27 15:38:53 UTC (rev 11567) |
327 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-09-27 15:53:48 UTC (rev 11568) |
328 |
@@ -118,7 +118,7 @@ |
329 |
import portage.eclass_cache |
330 |
from portage.localization import _ |
331 |
from portage.update import dep_transform, fixdbentries, grab_updates, \ |
332 |
- parse_updates, update_config_files, update_dbentries |
333 |
+ parse_updates, update_config_files, update_dbentries, update_dbentry |
334 |
|
335 |
# Need these functions directly in portage namespace to not break every external tool in existence |
336 |
from portage.versions import best, catpkgsplit, catsplit, pkgcmp, \ |
337 |
@@ -7154,6 +7154,7 @@ |
338 |
global secpass |
339 |
if secpass < 2 or "SANDBOX_ACTIVE" in os.environ: |
340 |
return |
341 |
+ root = "/" |
342 |
mysettings = trees["/"]["vartree"].settings |
343 |
updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates") |
344 |
|
345 |
@@ -7187,6 +7188,20 @@ |
346 |
for msg in errors: |
347 |
writemsg("%s\n" % msg, noiselevel=-1) |
348 |
|
349 |
+ world_file = os.path.join(root, WORLD_FILE) |
350 |
+ world_list = grabfile(world_file) |
351 |
+ world_modified = False |
352 |
+ for update_cmd in myupd: |
353 |
+ for pos, atom in enumerate(world_list): |
354 |
+ new_atom = update_dbentry(update_cmd, atom) |
355 |
+ if atom != new_atom: |
356 |
+ world_list[pos] = new_atom |
357 |
+ world_modified = True |
358 |
+ if world_modified: |
359 |
+ world_list.sort() |
360 |
+ write_atomic(world_file, |
361 |
+ "".join("%s\n" % (x,) for x in world_list)) |
362 |
+ |
363 |
update_config_files("/", |
364 |
mysettings.get("CONFIG_PROTECT","").split(), |
365 |
mysettings.get("CONFIG_PROTECT_MASK","").split(), |
366 |
|
367 |
Modified: main/branches/prefix/pym/portage/news.py |
368 |
=================================================================== |
369 |
--- main/branches/prefix/pym/portage/news.py 2008-09-27 15:38:53 UTC (rev 11567) |
370 |
+++ main/branches/prefix/pym/portage/news.py 2008-09-27 15:53:48 UTC (rev 11568) |
371 |
@@ -3,14 +3,18 @@ |
372 |
# Distributed under the terms of the GNU General Public License v2 |
373 |
# $Id$ |
374 |
|
375 |
+__all__ = ["NewsManager", "NewsItem", "DisplayRestriction", |
376 |
+ "DisplayProfileRestriction", "DisplayKeywordRestriction", |
377 |
+ "DisplayInstalledRestriction"] |
378 |
+ |
379 |
import errno |
380 |
import os |
381 |
import re |
382 |
-from portage.const import INCREMENTALS, PROFILE_PATH, NEWS_LIB_PATH |
383 |
-from portage.util import ensure_dirs, apply_permissions, normalize_path, grabfile, write_atomic |
384 |
+from portage.util import apply_permissions, ensure_dirs, grabfile, \ |
385 |
+ grablines, normalize_path, write_atomic |
386 |
from portage.data import portage_gid |
387 |
-from portage.locks import lockfile, unlockfile, lockdir, unlockdir |
388 |
-from portage.exception import FileNotFound, OperationNotPermitted |
389 |
+from portage.locks import lockfile, unlockfile |
390 |
+from portage.exception import OperationNotPermitted |
391 |
|
392 |
class NewsManager(object): |
393 |
""" |
394 |
@@ -138,19 +142,9 @@ |
395 |
if os.access(os.path.dirname(unreadfile), os.W_OK): |
396 |
# TODO: implement shared readonly locks |
397 |
unread_lock = lockfile(unreadfile) |
398 |
- try: |
399 |
- f = open(unreadfile) |
400 |
- try: |
401 |
- unread = f.readlines() |
402 |
- finally: |
403 |
- f.close() |
404 |
- except EnvironmentError, e: |
405 |
- if e.errno != errno.ENOENT: |
406 |
- raise |
407 |
- del e |
408 |
- return 0 |
409 |
- if len(unread): |
410 |
- return len(unread) |
411 |
+ |
412 |
+ return len(grablines(unreadfile)) |
413 |
+ |
414 |
finally: |
415 |
if unread_lock: |
416 |
unlockfile(unread_lock) |
417 |
|
418 |
Modified: main/branches/prefix/pym/portage/update.py |
419 |
=================================================================== |
420 |
--- main/branches/prefix/pym/portage/update.py 2008-09-27 15:38:53 UTC (rev 11567) |
421 |
+++ main/branches/prefix/pym/portage/update.py 2008-09-27 15:53:48 UTC (rev 11568) |
422 |
@@ -177,19 +177,6 @@ |
423 |
del file_contents[x] |
424 |
continue |
425 |
|
426 |
- worldlist = grabfile(os.path.join(config_root, WORLD_FILE)) |
427 |
- modified = False |
428 |
- for update_cmd in update_iter: |
429 |
- for pos, atom in enumerate(worldlist): |
430 |
- new_atom = update_dbentry(update_cmd, atom) |
431 |
- if atom != new_atom: |
432 |
- worldlist[pos] = new_atom |
433 |
- modified = True |
434 |
- if modified: |
435 |
- worldlist.sort() |
436 |
- write_atomic(os.path.join(config_root, WORLD_FILE), |
437 |
- "\n".join(worldlist)+"\n") |
438 |
- |
439 |
# update /etc/portage/packages.* |
440 |
ignore_line_re = re.compile(r'^#|^\s*$') |
441 |
for update_cmd in update_iter: |