Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11785 - in main/branches/prefix: bin pym/_emerge pym/portage pym/portage/dbapi
Date: Sat, 01 Nov 2008 16:01:45
Message-Id: E1KwIuz-00083B-Uv@stork.gentoo.org
1 Author: grobian
2 Date: 2008-11-01 16:01:40 +0000 (Sat, 01 Nov 2008)
3 New Revision: 11785
4
5 Modified:
6 main/branches/prefix/bin/ebuild.sh
7 main/branches/prefix/bin/emake
8 main/branches/prefix/bin/isolated-functions.sh
9 main/branches/prefix/bin/regenworld
10 main/branches/prefix/bin/repoman
11 main/branches/prefix/pym/_emerge/__init__.py
12 main/branches/prefix/pym/portage/__init__.py
13 main/branches/prefix/pym/portage/dbapi/__init__.py
14 main/branches/prefix/pym/portage/dbapi/bintree.py
15 main/branches/prefix/pym/portage/dbapi/vartree.py
16 main/branches/prefix/pym/portage/dep.py
17 Log:
18 Merged from trunk -r11755:11768
19
20 | 11756 | Bug #244975 - Don't allow the user to make portage unmerge |
21 | zmedico | itself since there's never any valid reason to do so. |
22
23 | 11758 | Use portage.const.PORTAGE_PACKAGE_ATOM where appropriate. |
24 | zmedico | |
25
26 | 11759 | Pass a Package instance into the config.setcpv() call. |
27 | zmedico | |
28
29 | 11760 | Fix broken stuff to avoid tracebacks when running in commit |
30 | zmedico | mode with --pretend and no vcs. |
31
32 | 11761 | Remove unused conditional_disabled and conditional_enabled |
33 | zmedico | attributes from _use_dep.__slots__. |
34
35 | 11762 | Bug #244947 - Add repoman support for checking masked and |
36 | zmedico | forced flags when verifying USE deps. Thanks to Brian |
37 | | Harring for reporting. |
38
39 | 11763 | Revert previous commit since it doesn't properly calculate |
40 | zmedico | masked and forced flags for the package being matched (it |
41 | | erroneously uses the masked and forced flags from the parent |
42 | | package). |
43
44 | 11764 | Bug #236609 - Fix columns calculation for TERM="dumb". |
45 | zmedico | Thanks to Ulrich M?\195?\188ller <ulm@g.o> for the patch. |
46
47 | 11765 | In dblink._collision_protect(), remove redundant |
48 | zmedico | self.isowner() calls since self hasn't yet been merged and |
49 | | therefore has no CONTENTS file for ownership checks. Also, |
50 | | remove redundant isprotected() calls. |
51
52 | 11766 | Bug #243178 - Handle file collisions with preserved libs by |
53 | zmedico | allowing the current package to assume ownership and |
54 | | unregistering the preserved libraries. |
55
56 | 11767 | Eliminate duplicate code by calling equivalent |
57 | zmedico | dblink._clear_contents_cache(). |
58
59 | 11768 | Bug #244947 - Add basic repoman support for checking masked |
60 | zmedico | and forced flags when verifying USE deps. TODO: Add repoman |
61 | | support in dep_check() for evaluation of conditional USE |
62 | | deps based on forced/masked flags. masked flags, so that |
63 | | repoman can also |
64 Merged from trunk -r11768:11776
65
66 | 11769 | Bug #244947 - Add repoman support for checking masked and |
67 | zmedico | forced flags on conditional USE deps. |
68
69 | 11770 | Bug #244792 - Remove confcache support. |
70 | zmedico | |
71
72 | 11771 | Bug #241906 - Handle InvalidAtom exception raised from |
73 | zmedico | vardbapi.match(). |
74
75 | 11772 | Bug #240295 - When emake is called, echo the make command |
76 | zmedico | similar to the way that econf echoes the configure command. |
77
78 | 11773 | Filter PORTAGE_VERBOSE in save_ebuild_env(). |
79 | zmedico | |
80
81 | 11774 | Remove unused imports. |
82 | zmedico | |
83
84 | 11775 | Define __all__ and remove unused import. |
85 | zmedico | |
86
87 | 11776 | Define __all__ and remove unused imports. |
88 | zmedico | |
89
90
91 Modified: main/branches/prefix/bin/ebuild.sh
92 ===================================================================
93 --- main/branches/prefix/bin/ebuild.sh 2008-11-01 10:51:13 UTC (rev 11784)
94 +++ main/branches/prefix/bin/ebuild.sh 2008-11-01 16:01:40 UTC (rev 11785)
95 @@ -495,32 +495,7 @@
96 LOCAL_EXTRA_ECONF="--libdir=${CONF_LIBDIR_RESULT} ${LOCAL_EXTRA_ECONF}"
97 fi
98
99 - local TMP_CONFCACHE_DIR CONFCACHE_ARG
100 - if hasq confcache $FEATURES && ! hasq confcache $RESTRICT; then
101 - CONFCACHE="$(type -P confcache)"
102 - if [ -z "${CONFCACHE}" ]; then
103 - ewarn "disabling confcache, binary cannot be found"
104 - else
105 - CONFCACHE="${CONFCACHE/ /\ }"
106 - TMP_CONFCACHE_DIR="${CONFCACHE:+${CONFCACHE_DIR:-${PORTAGE_TMPDIR}/confcache}}"
107 - TMP_CONFCACHE_DIR="${TMP_CONFCACHE_DIR/ /\ }"
108 - CONFCACHE_ARG="--confcache-dir"
109 - local s
110 - if [ -n "$CCACHE_DIR" ]; then
111 - s="$CCACHE_DIR"
112 - fi
113 - if [ -n "$DISTCC_DIR" ]; then
114 - s="${s:+${s}:}$DISTCC_DIR"
115 - fi
116 - if [ -n "$s" ]; then
117 - CONFCACHE_ARG="--confcache-ignore $s $CONFCACHE_ARG"
118 - fi
119 - fi
120 - else
121 - CONFCACHE=
122 - fi
123 -
124 - vecho ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \
125 + vecho "${ECONF_SOURCE}/configure" \
126 --prefix="${EPREFIX}"/usr \
127 --host=${CHOST} \
128 --mandir="${EPREFIX}"/usr/share/man \
129 @@ -531,7 +506,7 @@
130 "$@" \
131 ${LOCAL_EXTRA_ECONF}
132
133 - if ! ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \
134 + if ! "${ECONF_SOURCE}/configure" \
135 --prefix="${EPREFIX}"/usr \
136 --host=${CHOST} \
137 --mandir="${EPREFIX}"/usr/share/man \
138
139 Modified: main/branches/prefix/bin/emake
140 ===================================================================
141 --- main/branches/prefix/bin/emake 2008-11-01 10:51:13 UTC (rev 11784)
142 +++ main/branches/prefix/bin/emake 2008-11-01 16:01:40 UTC (rev 11785)
143 @@ -11,4 +11,6 @@
144 # /etc/make.globals here because emake is only called from an
145 # ebuild.
146
147 +[[ $PORTAGE_QUIET = 1 ]] || echo ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
148 +
149 exec ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
150
151 Modified: main/branches/prefix/bin/isolated-functions.sh
152 ===================================================================
153 --- main/branches/prefix/bin/isolated-functions.sh 2008-11-01 10:51:13 UTC (rev 11784)
154 +++ main/branches/prefix/bin/isolated-functions.sh 2008-11-01 16:01:40 UTC (rev 11785)
155 @@ -380,7 +380,7 @@
156 (( COLS > 0 )) || (( COLS = 80 ))
157 COLS=$((${COLS} - 8)) # width of [ ok ] == 7
158 # Adjust COLS so that eend works properly on a standard BSD console.
159 - [ "${TERM}" = "cons25" ] && COLS=$((${COLS} - 1))
160 + [[ $TERM = cons25 || $TERM = dumb ]] && ((COLS--))
161
162 # Now, ${ENDCOL} will move us to the end of the
163 # column; irregardless of character width
164 @@ -537,7 +537,7 @@
165 PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \
166 PORTAGE_QUIET \
167 PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_UPDATE_ENV \
168 - PORTAGE_WORKDIR_MODE PORTDIR \
169 + PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR \
170 PORTDIR_OVERLAY ${!PORTAGE_SANDBOX_*} PREROOTPATH \
171 PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \
172 RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL \
173
174 Modified: main/branches/prefix/bin/regenworld
175 ===================================================================
176 --- main/branches/prefix/bin/regenworld 2008-11-01 10:51:13 UTC (rev 11784)
177 +++ main/branches/prefix/bin/regenworld 2008-11-01 16:01:40 UTC (rev 11785)
178 @@ -4,6 +4,7 @@
179 # $Id$
180
181 import sys, os
182 +import portage.exception
183
184 # for an explanation on this logic, see pym/_emerge/__init__.py
185 import os
186 @@ -85,7 +86,7 @@
187 #print "checking:",mykey
188 try:
189 mylist=portage.db["/"]["vartree"].dbapi.match(mykey)
190 - except KeyError:
191 + except (portage.exception.InvalidAtom, KeyError):
192 if "--debug" in sys.argv:
193 print "* ignoring broken log entry for %s (likely injected)" % mykey
194 except ValueError, e:
195
196 Modified: main/branches/prefix/bin/repoman
197 ===================================================================
198 --- main/branches/prefix/bin/repoman 2008-11-01 10:51:13 UTC (rev 11784)
199 +++ main/branches/prefix/bin/repoman 2008-11-01 16:01:40 UTC (rev 11785)
200 @@ -750,6 +750,8 @@
201 modified_changelogs = set()
202 mychanged = []
203 mynew = []
204 +myremoved = []
205 +
206 if vcs == "cvs":
207 mycvstree = cvstree.getentries("./", recursive=1)
208 mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
209 @@ -1468,7 +1470,7 @@
210 portdb.mysettings = dep_settings
211 portdb.xcache = xcache
212 # for package.use.mask support inside dep_check
213 - dep_settings.setcpv("/".join((catdir, y)))
214 + dep_settings.setcpv(pkg)
215 dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
216 # just in case, prevent config.reset() from nuking these.
217 dep_settings.backup_changes("ACCEPT_KEYWORDS")
218 @@ -1815,7 +1817,8 @@
219 unameout += platform.processor()
220 else:
221 unameout += platform.machine()
222 - commitmessage+="\n(Portage version: "+str(portage_version)+"/"+vcs+"/"+unameout
223 + commitmessage += "\n(Portage version: %s/%s/%s" % \
224 + (portage_version, vcs, unameout)
225 if options.force:
226 commitmessage += ", RepoMan options: --force"
227 commitmessage += ")"
228
229 Modified: main/branches/prefix/pym/_emerge/__init__.py
230 ===================================================================
231 --- main/branches/prefix/pym/_emerge/__init__.py 2008-11-01 10:51:13 UTC (rev 11784)
232 +++ main/branches/prefix/pym/_emerge/__init__.py 2008-11-01 16:01:40 UTC (rev 11785)
233 @@ -56,13 +56,13 @@
234 import portage
235
236
237 -from portage import digraph, portdbapi
238 -from portage.const import NEWS_LIB_PATH, CACHE_PATH, PRIVATE_PATH, USER_CONFIG_PATH, GLOBAL_CONFIG_PATH
239 +from portage import digraph
240 +from portage.const import NEWS_LIB_PATH
241
242 import _emerge.help
243 import portage.xpak, commands, errno, re, socket, time, types
244 from portage.output import blue, bold, colorize, darkblue, darkgreen, darkred, green, \
245 - havecolor, nc_len, nocolor, red, teal, turquoise, white, xtermTitle, \
246 + nc_len, red, teal, turquoise, xtermTitle, \
247 xtermTitleReset, yellow
248 from portage.output import create_color_func
249 good = create_color_func("GOOD")
250 @@ -10531,7 +10531,7 @@
251 candidate_catpkgs=[]
252 global_unmerge=0
253 xterm_titles = "notitles" not in settings.features
254 -
255 + out = portage.output.EOutput()
256 pkg_cache = {}
257 db_keys = list(vartree.dbapi._aux_cache_keys)
258
259 @@ -10796,6 +10796,21 @@
260 # It could have been uninstalled
261 # by a concurrent process.
262 continue
263 +
264 + if unmerge_action != "clean" and \
265 + root_config.root == "/" and \
266 + portage.match_from_list(
267 + portage.const.PORTAGE_PACKAGE_ATOM, [pkg]):
268 + msg = ("Not unmerging package %s since there is no valid " + \
269 + "reason for portage to unmerge itself.") % (pkg.cpv,)
270 + for line in textwrap.wrap(msg, 75):
271 + out.eerror(line)
272 + # adjust pkgmap so the display output is correct
273 + pkgmap[cp]["selected"].remove(cpv)
274 + all_selected.remove(cpv)
275 + pkgmap[cp]["protected"].add(cpv)
276 + continue
277 +
278 parents = []
279 for s in installed_sets:
280 # skip sets that the user requested to unmerge, and skip world
281 @@ -10854,10 +10869,18 @@
282 print " %s\n" % ", ".join(parents)
283 # adjust pkgmap so the display output is correct
284 pkgmap[cp]["selected"].remove(cpv)
285 + all_selected.remove(cpv)
286 pkgmap[cp]["protected"].add(cpv)
287
288 del installed_sets
289
290 + numselected = len(all_selected)
291 + if not numselected:
292 + writemsg_level(
293 + "\n>>> No packages selected for removal by " + \
294 + unmerge_action + "\n")
295 + return 0
296 +
297 # Unmerge order only matters in some cases
298 if not ordered:
299 unordered = {}
300 @@ -11819,9 +11842,11 @@
301 portdb = trees[settings["ROOT"]]["porttree"].dbapi
302 root_config = trees[settings["ROOT"]]["root_config"]
303
304 - mybestpv = portdb.xmatch("bestmatch-visible", "sys-apps/portage")
305 + mybestpv = portdb.xmatch("bestmatch-visible",
306 + portage.const.PORTAGE_PACKAGE_ATOM)
307 mypvs = portage.best(
308 - trees[settings["ROOT"]]["vartree"].dbapi.match("sys-apps/portage"))
309 + trees[settings["ROOT"]]["vartree"].dbapi.match(
310 + portage.const.PORTAGE_PACKAGE_ATOM))
311
312 chk_updated_cfg_files(EPREFIX, settings.get("CONFIG_PROTECT","").split())
313
314
315 Modified: main/branches/prefix/pym/portage/__init__.py
316 ===================================================================
317 --- main/branches/prefix/pym/portage/__init__.py 2008-11-01 10:51:13 UTC (rev 11784)
318 +++ main/branches/prefix/pym/portage/__init__.py 2008-11-01 16:01:40 UTC (rev 11785)
319 @@ -2017,45 +2017,13 @@
320 if defaults != self.configdict["defaults"].get("USE",""):
321 self.configdict["defaults"]["USE"] = defaults
322 has_changed = True
323 - useforce = []
324 - pos = 0
325 - for i in xrange(len(self.profiles)):
326 - cpdict = self.puseforce_list[i].get(cp, None)
327 - if cpdict:
328 - keys = cpdict.keys()
329 - while keys:
330 - best_match = best_match_to_list(cpv_slot, keys)
331 - if best_match:
332 - keys.remove(best_match)
333 - useforce.insert(pos, cpdict[best_match])
334 - else:
335 - break
336 - del keys
337 - if self.useforce_list[i]:
338 - useforce.insert(pos, self.useforce_list[i])
339 - pos = len(useforce)
340 - useforce = set(stack_lists(useforce, incremental=True))
341 +
342 + useforce = self._getUseForce(cpv_slot)
343 if useforce != self.useforce:
344 self.useforce = useforce
345 has_changed = True
346 - usemask = []
347 - pos = 0
348 - for i in xrange(len(self.profiles)):
349 - cpdict = self.pusemask_list[i].get(cp, None)
350 - if cpdict:
351 - keys = cpdict.keys()
352 - while keys:
353 - best_match = best_match_to_list(cpv_slot, keys)
354 - if best_match:
355 - keys.remove(best_match)
356 - usemask.insert(pos, cpdict[best_match])
357 - else:
358 - break
359 - del keys
360 - if self.usemask_list[i]:
361 - usemask.insert(pos, self.usemask_list[i])
362 - pos = len(usemask)
363 - usemask = set(stack_lists(usemask, incremental=True))
364 +
365 + usemask = self._getUseMask(cpv_slot)
366 if usemask != self.usemask:
367 self.usemask = usemask
368 has_changed = True
369 @@ -2227,6 +2195,52 @@
370
371 return iuse_implicit
372
373 + def _getUseMask(self, pkg):
374 + cp = getattr(pkg, "cp", None)
375 + if cp is None:
376 + cp = dep_getkey(pkg)
377 + usemask = []
378 + pos = 0
379 + for i in xrange(len(self.profiles)):
380 + cpdict = self.pusemask_list[i].get(cp, None)
381 + if cpdict:
382 + keys = cpdict.keys()
383 + while keys:
384 + best_match = best_match_to_list(pkg, keys)
385 + if best_match:
386 + keys.remove(best_match)
387 + usemask.insert(pos, cpdict[best_match])
388 + else:
389 + break
390 + del keys
391 + if self.usemask_list[i]:
392 + usemask.insert(pos, self.usemask_list[i])
393 + pos = len(usemask)
394 + return set(stack_lists(usemask, incremental=True))
395 +
396 + def _getUseForce(self, pkg):
397 + cp = getattr(pkg, "cp", None)
398 + if cp is None:
399 + cp = dep_getkey(pkg)
400 + useforce = []
401 + pos = 0
402 + for i in xrange(len(self.profiles)):
403 + cpdict = self.puseforce_list[i].get(cp, None)
404 + if cpdict:
405 + keys = cpdict.keys()
406 + while keys:
407 + best_match = best_match_to_list(pkg, keys)
408 + if best_match:
409 + keys.remove(best_match)
410 + useforce.insert(pos, cpdict[best_match])
411 + else:
412 + break
413 + del keys
414 + if self.useforce_list[i]:
415 + useforce.insert(pos, self.useforce_list[i])
416 + pos = len(useforce)
417 + return set(stack_lists(useforce, incremental=True))
418 +
419 def _getMaskAtom(self, cpv, metadata):
420 """
421 Take a package and return a matching package.mask atom, or None if no
422 @@ -4956,10 +4970,6 @@
423 "basedir_var":"CCACHE_DIR",
424 "default_dir":os.path.join(mysettings["PORTAGE_TMPDIR"], "ccache"),
425 "always_recurse":False},
426 - "confcache":{
427 - "basedir_var":"CONFCACHE_DIR",
428 - "default_dir":os.path.join(mysettings["PORTAGE_TMPDIR"], "confcache"),
429 - "always_recurse":False},
430 "distcc":{
431 "basedir_var":"DISTCC_DIR",
432 "default_dir":os.path.join(mysettings["BUILD_PREFIX"], ".distcc"),
433 @@ -6144,7 +6154,7 @@
434 return newsplit
435
436 def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
437 - trees=None, **kwargs):
438 + trees=None, use_mask=None, use_force=None, **kwargs):
439 """Recursively expand new-style virtuals so as to collapse one or more
440 levels of indirection. In dep_zapdeps, new-style virtuals will be assigned
441 zero cost regardless of whether or not they are currently installed. Virtual
442 @@ -6180,8 +6190,14 @@
443 raise portage.exception.ParseError(
444 "invalid atom: '%s'" % x)
445
446 - # Repoman only checks IUSE for USE deps, so there's
447 - # no need to evaluate conditionals.
448 + if repoman and x.use and x.use.conditional:
449 + evaluated_atom = portage.dep.remove_slot(x)
450 + if x.slot:
451 + evaluated_atom += ":%s" % x.slot
452 + evaluated_atom += str(x.use._eval_qa_conditionals(
453 + use_mask, use_force))
454 + x = portage.dep.Atom(evaluated_atom)
455 +
456 if not repoman and \
457 myuse is not None and isinstance(x, portage.dep.Atom) and x.use:
458 if x.use.conditional:
459 @@ -6572,7 +6588,8 @@
460 # collapse one or more levels of indirection.
461 try:
462 mysplit = _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings,
463 - use=use, mode=mode, myuse=myuse, use_cache=use_cache,
464 + use=use, mode=mode, myuse=myuse,
465 + use_force=useforce, use_mask=mymasks, use_cache=use_cache,
466 use_binaries=use_binaries, myroot=myroot, trees=trees)
467 except portage.exception.ParseError, e:
468 return [0, str(e)]
469
470 Modified: main/branches/prefix/pym/portage/dbapi/__init__.py
471 ===================================================================
472 --- main/branches/prefix/pym/portage/dbapi/__init__.py 2008-11-01 10:51:13 UTC (rev 11784)
473 +++ main/branches/prefix/pym/portage/dbapi/__init__.py 2008-11-01 16:01:40 UTC (rev 11785)
474 @@ -2,15 +2,16 @@
475 # Distributed under the terms of the GNU General Public License v2
476 # $Id$
477
478 +__all__ = ["dbapi"]
479 +
480 import os
481 import re
482 -from portage.dep import Atom, dep_getslot, dep_getkey, \
483 - dep_getusedeps, match_from_list
484 +from portage.dep import match_from_list
485 from portage.locks import unlockfile
486 from portage.output import red
487 from portage.util import writemsg
488 from portage import auxdbkeys, dep_expand
489 -from portage.versions import catpkgsplit, catsplit, pkgcmp
490 +from portage.versions import catpkgsplit, pkgcmp
491
492
493 class dbapi(object):
494 @@ -150,7 +151,7 @@
495 self._iuse_implicit = self.settings._get_implicit_iuse()
496 for cpv in cpv_iter:
497 try:
498 - iuse, use = self.aux_get(cpv, ["IUSE", "USE"])
499 + iuse, slot, use = self.aux_get(cpv, ["IUSE", "SLOT", "USE"])
500 except KeyError:
501 continue
502 use = use.split()
503 @@ -169,6 +170,20 @@
504 continue
505 if atom.use.disabled.intersection(use):
506 continue
507 + else:
508 + # Check masked and forced flags for repoman.
509 + mysettings = getattr(self, "mysettings", None)
510 + if mysettings is not None and not mysettings.local_config:
511 +
512 + pkg = "%s:%s" % (cpv, slot)
513 + usemask = mysettings._getUseMask(pkg)
514 + if usemask.intersection(atom.use.enabled):
515 + continue
516 +
517 + useforce = mysettings._getUseForce(pkg).difference(usemask)
518 + if useforce.intersection(atom.use.disabled):
519 + continue
520 +
521 yield cpv
522
523 def invalidentry(self, mypath):
524
525 Modified: main/branches/prefix/pym/portage/dbapi/bintree.py
526 ===================================================================
527 --- main/branches/prefix/pym/portage/dbapi/bintree.py 2008-11-01 10:51:13 UTC (rev 11784)
528 +++ main/branches/prefix/pym/portage/dbapi/bintree.py 2008-11-01 16:01:40 UTC (rev 11785)
529 @@ -2,10 +2,12 @@
530 # Distributed under the terms of the GNU General Public License v2
531 # $Id$
532
533 +__all__ = ["bindbapi", "binarytree"]
534 +
535 from portage.cache.mappings import slot_dict_class
536 from portage.dep import isvalidatom, isjustname, dep_getkey, match_from_list
537 from portage.dbapi.virtual import fakedbapi
538 -from portage.exception import InvalidPackageName, InvalidAtom, \
539 +from portage.exception import InvalidPackageName, \
540 PermissionDenied, PortageException
541 from portage.output import green, EOutput
542 from portage.util import ensure_dirs, normalize_path, writemsg, writemsg_stdout
543
544 Modified: main/branches/prefix/pym/portage/dbapi/vartree.py
545 ===================================================================
546 --- main/branches/prefix/pym/portage/dbapi/vartree.py 2008-11-01 10:51:13 UTC (rev 11784)
547 +++ main/branches/prefix/pym/portage/dbapi/vartree.py 2008-11-01 16:01:40 UTC (rev 11785)
548 @@ -8,11 +8,11 @@
549
550 from portage.checksum import perform_md5
551 from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
552 - PRIVATE_PATH, VDB_PATH, EPREFIX, EPREFIX_LSTRIP
553 -from portage.data import portage_gid, portage_uid, secpass, ostype
554 + PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH, EPREFIX, EPREFIX_LSTRIP
555 +from portage.data import portage_gid, portage_uid, secpass
556 from portage.dbapi import dbapi
557 from portage.dep import use_reduce, paren_reduce, isvalidatom, \
558 - isjustname, dep_getkey
559 + isjustname, dep_getkey, match_from_list
560 from portage.exception import InvalidData, InvalidPackageName, \
561 FileNotFound, PermissionDenied, UnsupportedAPIException
562 from portage.locks import lockdir, unlockdir
563 @@ -3135,6 +3135,18 @@
564 collision_ignore = set([normalize_path(myignore) for myignore in \
565 shlex.split(self.settings.get("COLLISION_IGNORE", ""))])
566
567 + # For collisions with preserved libraries, the current package
568 + # will assume ownership and the libraries will be unregistered.
569 + plib_dict = self.vartree.dbapi.plib_registry.getPreservedLibs()
570 + plib_cpv_map = {}
571 + plib_paths = set()
572 + for cpv, paths in plib_dict.iteritems():
573 + plib_paths.update(paths)
574 + for f in paths:
575 + plib_cpv_map[f] = cpv
576 + plib_inodes = self._lstat_inode_map(plib_paths)
577 + plib_collisions = {}
578 +
579 showMessage = self._display_merge
580 scheduler = self._scheduler
581 stopmerge = False
582 @@ -3186,12 +3198,29 @@
583 raise
584 if f[0] != "/":
585 f="/"+f
586 +
587 + plibs = plib_inodes.get((dest_lstat.st_dev, dest_lstat.st_ino))
588 + if plibs:
589 + for path in plibs:
590 + cpv = plib_cpv_map[path]
591 + paths = plib_collisions.get(cpv)
592 + if paths is None:
593 + paths = set()
594 + plib_collisions[cpv] = paths
595 + paths.add(path)
596 + # The current package will assume ownership and the
597 + # libraries will be unregistered, so exclude this
598 + # path from the normal collisions.
599 + continue
600 +
601 isowned = False
602 full_path = os.path.join(destroot, f.lstrip(os.path.sep))
603 - for ver in [self] + mypkglist:
604 - if (ver.isowner(f, destroot) or ver.isprotected(full_path)):
605 + for ver in mypkglist:
606 + if ver.isowner(f, destroot):
607 isowned = True
608 break
609 + if not isowned and self.isprotected(full_path):
610 + isowned = True
611 if not isowned:
612 stopmerge = True
613 if collision_ignore:
614 @@ -3204,8 +3233,34 @@
615 break
616 if stopmerge:
617 collisions.append(f)
618 - return collisions
619 + return collisions, plib_collisions
620
621 + def _lstat_inode_map(self, path_iter):
622 + """
623 + Use lstat to create a map of the form:
624 + {(st_dev, st_ino) : set([path1, path2, ...])}
625 + Multiple paths may reference the same inode due to hardlinks.
626 + All lstat() calls are relative to self.myroot.
627 + """
628 + root = self.myroot
629 + inode_map = {}
630 + for f in path_iter:
631 + path = os.path.join(root, f.lstrip(os.sep))
632 + try:
633 + st = os.lstat(path)
634 + except OSError, e:
635 + if e.errno not in (errno.ENOENT, errno.ENOTDIR):
636 + raise
637 + del e
638 + continue
639 + key = (st.st_dev, st.st_ino)
640 + paths = inode_map.get(key)
641 + if paths is None:
642 + paths = set()
643 + inode_map[key] = paths
644 + paths.add(f)
645 + return inode_map
646 +
647 def _security_check(self, installed_instances):
648 if not installed_instances:
649 return 0
650 @@ -3463,7 +3518,8 @@
651 blockers = self._blockers()
652 if blockers is None:
653 blockers = []
654 - collisions = self._collision_protect(srcroot, destroot,
655 + collisions, plib_collisions = \
656 + self._collision_protect(srcroot, destroot,
657 others_in_slot + blockers, myfilelist + mylinklist)
658
659 # Make sure the ebuild environment is initialized and that ${T}/elog
660 @@ -3697,17 +3753,14 @@
661 # just been merged.
662 others_in_slot.append(self) # self has just been merged
663 for dblnk in others_in_slot:
664 - dblnk.contentscache = None
665 - dblnk._contents_inodes = None
666 - dblnk._contents_basenames = None
667 + dblnk._clear_contents_cache()
668
669 # If portage is reinstalling itself, remove the old
670 # version now since we want to use the temporary
671 # PORTAGE_BIN_PATH that will be removed when we return.
672 reinstall_self = False
673 if self.myroot == "/" and \
674 - "sys-apps" == self.cat and \
675 - "portage" == pkgsplit(self.pkg)[0]:
676 + match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]):
677 reinstall_self = True
678
679 autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes"
680 @@ -3746,6 +3799,24 @@
681 self.vartree.dbapi.removeFromContents(blocker, iter(contents),
682 relative_paths=False)
683
684 + # Unregister any preserved libs that this package has overwritten
685 + # and update the contents of the packages that owned them.
686 + plib_registry = self.vartree.dbapi.plib_registry
687 + plib_dict = plib_registry.getPreservedLibs()
688 + for cpv, paths in plib_collisions.iteritems():
689 + if cpv not in plib_dict:
690 + continue
691 + if cpv == self.mycpv:
692 + continue
693 + try:
694 + slot, counter = self.vartree.dbapi.aux_get(
695 + cpv, ["SLOT", "COUNTER"])
696 + except KeyError:
697 + continue
698 + remaining = [f for f in plib_dict[cpv] if f not in paths]
699 + plib_registry.register(cpv, slot, counter, remaining)
700 + self.vartree.dbapi.removeFromContents(cpv, paths)
701 +
702 self.vartree.dbapi._add(self)
703 contents = self.getcontents()
704
705 @@ -4094,8 +4165,7 @@
706 if self.vartree.dbapi._categories is not None:
707 self.vartree.dbapi._categories = None
708 if self.myroot == "/" and \
709 - "sys-apps" == self.cat and \
710 - "portage" == pkgsplit(self.pkg)[0]:
711 + match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]):
712 settings = self.settings
713 base_path_orig = os.path.dirname(settings["PORTAGE_BIN_PATH"])
714 from tempfile import mkdtemp
715
716 Modified: main/branches/prefix/pym/portage/dep.py
717 ===================================================================
718 --- main/branches/prefix/pym/portage/dep.py 2008-11-01 10:51:13 UTC (rev 11784)
719 +++ main/branches/prefix/pym/portage/dep.py 2008-11-01 16:01:40 UTC (rev 11785)
720 @@ -341,8 +341,8 @@
721
722 class _use_dep(object):
723
724 - __slots__ = ("__weakref__", "conditional", "conditional_disabled",
725 - "conditional_enabled", "disabled", "enabled", "tokens", "required")
726 + __slots__ = ("__weakref__", "conditional",
727 + "disabled", "enabled", "tokens", "required")
728
729 _conditionals_class = portage.cache.mappings.slot_dict_class(
730 ("disabled", "enabled", "equal", "not_equal"), prefix="")
731 @@ -459,6 +459,31 @@
732
733 return _use_dep(tokens)
734
735 + def _eval_qa_conditionals(self, use_mask, use_force):
736 + """
737 + For repoman, evaluate all possible combinations within the constraints
738 + of the given use.force and use.mask settings. The result may seem
739 + ambiguous in the sense that the same flag can be in both the enabled
740 + and disabled sets, but this is useful within the context of how its
741 + intended to be used by repoman. It is assumed that the caller has
742 + already ensured that there is no intersection between the given
743 + use_mask and use_force sets when necessary.
744 + """
745 + tokens = []
746 +
747 + conditional = self.conditional
748 + tokens.extend(self.enabled)
749 + tokens.extend("-" + x for x in self.disabled)
750 + tokens.extend(x for x in conditional.enabled if x not in use_mask)
751 + tokens.extend("-" + x for x in conditional.disabled if x not in use_force)
752 +
753 + tokens.extend(x for x in conditional.equal if x not in use_mask)
754 + tokens.extend("-" + x for x in conditional.equal if x not in use_force)
755 + tokens.extend("-" + x for x in conditional.not_equal if x not in use_mask)
756 + tokens.extend(x for x in conditional.not_equal if x not in use_force)
757 +
758 + return _use_dep(tokens)
759 +
760 class _AtomCache(type):
761 """
762 Cache Atom instances from constructor calls and reuse