Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11322 - in main/branches/prefix: bin cnf doc/config doc/dependency_resolution man pym/_emerge pym/portage pym/portage/cache pym/portage/dbapi pym/portage/sets
Date: Sun, 03 Aug 2008 19:18:00
Message-Id: E1KPj5Y-00052a-02@stork.gentoo.org
1 Author: grobian
2 Date: 2008-08-03 19:17:54 +0000 (Sun, 03 Aug 2008)
3 New Revision: 11322
4
5 Modified:
6 main/branches/prefix/bin/emaint
7 main/branches/prefix/bin/repoman
8 main/branches/prefix/cnf/make.conf
9 main/branches/prefix/cnf/make.conf.sparc-fbsd.diff
10 main/branches/prefix/cnf/make.conf.x86-fbsd.diff
11 main/branches/prefix/cnf/sets.conf
12 main/branches/prefix/doc/config/sets.docbook
13 main/branches/prefix/doc/dependency_resolution/task_scheduling.docbook
14 main/branches/prefix/man/make.conf.5
15 main/branches/prefix/pym/_emerge/__init__.py
16 main/branches/prefix/pym/portage/__init__.py
17 main/branches/prefix/pym/portage/cache/mappings.py
18 main/branches/prefix/pym/portage/dbapi/bintree.py
19 main/branches/prefix/pym/portage/dbapi/vartree.py
20 main/branches/prefix/pym/portage/sets/dbapi.py
21 main/branches/prefix/pym/portage/sets/profiles.py
22 Log:
23 Merged from trunk 11302:11320
24
25 | 11303 | Bug #233487 - Fix --fetch-all-uri breakage: * Make |
26 | zmedico | --fetch-all-uri imply --fetchonly so that all the |
27 | | --fetchonly conditionals apply to --fetch-all-uri as well. * |
28 | | Add an EbuildFetcher.fetchall attribute, and also add the |
29 | | required support to portage.doebuild() for a "fetchall" |
30 | | phase that EbuildFetcher can invoke in the background via |
31 | | the ebuild(1) command. |
32
33 | 11304 | Bug #229033 - Use `svn propget -R svn:keywords` to detect |
34 | zmedico | which will have changed headers that require an additional |
35 | | manifest commit. Thanks to Fabian Groffen for this patch |
36 | | which I've made some modifications to: * For clarity, use |
37 | | separate "no_expansion" variable for cvs bin blobs. * Fix |
38 | | svn keyword parsing to properly handle multiple keywords |
39 | | delimited by newlines. |
40
41 | 11305 | Remove the list of FEATURES descriptions from |
42 | zmedico | make.conf.example and replace it with a reference to the |
43 | | make.conf(5) man page. |
44
45 | 11306 | Fix new rejects in cnf/make.conf.*.diff. |
46 | zmedico | |
47
48 | 11307 | Optimize `emaint` --fix binhost so that it the Packages file |
49 | zmedico | isn't re-read and re-written for each package that's |
50 | | updated. Instead, hold a lock for the whole time the command |
51 | | is running and just update it once. |
52
53 | 11308 | Make InheritSet more like DowngradeSet, and check INHERITED |
54 | zmedico | from the highest visible ebuild in the portage tree rather |
55 | | than from the installed package itself. |
56
57 | 11309 | Bug #233252 - Handle InvalidAtom exceptions that can be |
58 | zmedico | raised from depgraph._add_dep() calls inside |
59 | | _add_pkg_deps(). |
60
61 | 11310 | Add DowngradeSet and OwnerSet to __all__. |
62 | zmedico | |
63
64 | 11311 | Update the Parallel Scheduling section to describe the |
65 | zmedico | current algorithm. |
66
67 | 11312 | Make EbuildFetcher pass a copy of os.environ to the |
68 | zmedico | ebuild(1) subprocess so that any incremental variables have |
69 | | been overridden are correctly considered by the config |
70 | | instance in the subproccess. |
71
72 | 11314 | Add debug support to PackagesSystemSet since robbat2 is |
73 | zmedico | reporting an empty set for some unknown reason. |
74
75 | 11315 | * Add INHERITED to vardbapi._aux_cache_keys since |
76 | zmedico | Package.metadata_keys also includes this one now. * Fix |
77 | | pull_me calculation inside vardbapi.aux_get() so that it |
78 | | correctly subtracts _mtime_ from the list of keys to pull. |
79
80 | 11316 | In the file collision elog message, only say 'NOT merged' |
81 | zmedico | when collision-protect is enabled. Thanks to dberkholz for |
82 | | reporting. |
83
84 | 11317 | Add a new RestrictSet which contains all packages that match |
85 | zmedico | specified RESTRICT values. This could be useful for |
86 | | implementing something like a @live-rebuild based on |
87 | | RESTRICT metadata, as suggested in bug #233589. |
88
89 | 11318 | Document the fact that use of @installed/EverythingSet makes |
90 | zmedico | it impossible for emerge to solve blockers by automatic |
91 | | uninstallation of blocked packages. |
92
93 | 11319 | Handle missing sets, to avoid KeyError raised from |
94 | zmedico | unmerge(). |
95
96 | 11320 | Add a more generic VariableSet to replace the InheritSet and |
97 | zmedico | RestrictSet classes. Thanks to Arfrever Frehtes Taifersar |
98 | | Arahesis for this patch from bug #233589 (with some minor |
99 | | adjustments from me). |
100
101
102 Modified: main/branches/prefix/bin/emaint
103 ===================================================================
104 --- main/branches/prefix/bin/emaint 2008-08-03 19:14:53 UTC (rev 11321)
105 +++ main/branches/prefix/bin/emaint 2008-08-03 19:17:54 UTC (rev 11322)
106 @@ -114,8 +114,7 @@
107 self._bintree = portage.db[myroot]["bintree"]
108 self._bintree.populate()
109 self._pkgindex_file = os.path.join(self._bintree.pkgdir, "Packages")
110 - from portage import getbinpkg
111 - self._pkgindex = getbinpkg.PackageIndex()
112 + self._pkgindex = self._bintree._new_pkgindex()
113 f = open(self._pkgindex_file, 'r')
114 try:
115 self._pkgindex.read(f)
116 @@ -151,7 +150,7 @@
117 cpv_all = self._bintree.dbapi.cpv_all()
118 cpv_all.sort()
119 missing = []
120 - maxval = len(cpv_all)
121 + maxval = 0
122 if onProgress:
123 onProgress(maxval, 0)
124 pkgindex = self._pkgindex
125 @@ -159,35 +158,61 @@
126 metadata = {}
127 for d in pkgindex.packages:
128 metadata[d["CPV"]] = d
129 +
130 for i, cpv in enumerate(cpv_all):
131 d = metadata.get(cpv)
132 if not d or "MD5" not in d:
133 - bintree.inject(cpv)
134 - if onProgress:
135 - onProgress(maxval, i+1)
136 + missing.append(cpv)
137 +
138 stale = set(metadata).difference(cpv_all)
139 - if stale:
140 + if missing or stale:
141 from portage import locks
142 pkgindex_lock = locks.lockfile(
143 self._pkgindex_file, wantnewlockfile=1)
144 try:
145 - from portage import getbinpkg
146 - pkgindex = getbinpkg.PackageIndex()
147 + # Repopulate with lock held.
148 + bintree._populate()
149 + cpv_all = self._bintree.dbapi.cpv_all()
150 + cpv_all.sort()
151 +
152 + pkgindex = bintree._new_pkgindex()
153 self._pkgindex = pkgindex
154 f = open(self._pkgindex_file, 'r')
155 try:
156 self._pkgindex.read(f)
157 finally:
158 f.close()
159 - from portage.dbapi.bintree import binarytree
160 - self._bintree = binarytree(bintree.root, bintree.pkgdir,
161 - settings=bintree.settings)
162 - del bintree
163 - portage.db[self._bintree.root]["bintree"] = self._bintree
164 - self._bintree._populate()
165 +
166 + metadata = {}
167 + for d in pkgindex.packages:
168 + metadata[d["CPV"]] = d
169 +
170 + # Recount missing packages, with lock held.
171 + del missing[:]
172 + for i, cpv in enumerate(cpv_all):
173 + d = metadata.get(cpv)
174 + if not d or "MD5" not in d:
175 + missing.append(cpv)
176 +
177 + maxval = len(missing)
178 + for i, cpv in enumerate(missing):
179 + try:
180 + metadata[cpv] = bintree._pkgindex_entry(cpv)
181 + except portage.exception.InvalidDependString:
182 + writemsg("!!! Invalid binary package: '%s'\n" % \
183 + bintree.getname(cpv), noiselevel=-1)
184 +
185 + if onProgress:
186 + onProgress(maxval, i+1)
187 +
188 for cpv in set(metadata).difference(
189 self._bintree.dbapi.cpv_all()):
190 del metadata[cpv]
191 +
192 + # We've updated the pkgindex, so set it to
193 + # repopulate when necessary.
194 + bintree.populated = False
195 +
196 del pkgindex.packages[:]
197 pkgindex.packages.extend(metadata.itervalues())
198 from portage.util import atomic_ofstream
199 @@ -198,6 +223,11 @@
200 f.close()
201 finally:
202 locks.unlockfile(pkgindex_lock)
203 +
204 + if onProgress:
205 + if maxval == 0:
206 + maxval = 1
207 + onProgress(maxval, maxval)
208 return None
209
210 class MoveHandler(object):
211
212 Modified: main/branches/prefix/bin/repoman
213 ===================================================================
214 --- main/branches/prefix/bin/repoman 2008-08-03 19:14:53 UTC (rev 11321)
215 +++ main/branches/prefix/bin/repoman 2008-08-03 19:17:54 UTC (rev 11322)
216 @@ -1745,20 +1745,29 @@
217 mynew=portage.cvstree.findnew(mycvstree,recursive=1,basedir="./")
218 myremoved=portage.cvstree.findremoved(mycvstree,recursive=1,basedir="./")
219 bin_blob_pattern = re.compile("^-kb$")
220 - bin_blobs = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern,
221 + no_expansion = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern,
222 recursive=1, basedir="./"))
223
224
225 if vcs == "svn":
226 svnstatus = os.popen("svn status").readlines()
227 mychanged = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("M") ]
228 - for manifest in [ file for file in mychanged if '/Manifest' in file ]:
229 - mychanged.remove(manifest)
230 - mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ]
231 + mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ]
232 myremoved = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("D") ]
233 - # no idea how to detect binaries in SVN
234 - bin_blobs = []
235 + # in contrast to CVS, SVN expands nothing by default.
236 + # bin_blobs historically
237 + # were just there to see what files need to be checked for
238 + # keyword expansion, which is exactly what we do here, so
239 + # slightly change the semantic meaning of "bin_blob"... In the
240 + # future we could store which keyword is expanded.
241 + props = os.popen("svn propget -R svn:keywords").readlines()
242
243 + # For files with multiple props set, props are delimited by newlines,
244 + # so exclude lines that don't contain " - " since each of those lines
245 + # only a contain props for a file listed on a previous line.
246 + expansion = set(prop.split(" - ")[0] \
247 + for prop in props if " - " in prop)
248 +
249 if vcs:
250 if not (mychanged or mynew or myremoved):
251 print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\""
252 @@ -1777,8 +1786,17 @@
253 headerstring = "'\$(Header|Id)"
254 headerstring += ".*\$'"
255 for myfile in myupdates:
256 - if myfile in bin_blobs:
257 - continue
258 +
259 + # for CVS, no_expansion contains files that are excluded from expansion
260 + if vcs == "cvs":
261 + if myfile in no_expansion:
262 + continue
263 +
264 + # for SVN, expansion contains files that are included in expansion
265 + elif vcs == "svn":
266 + if myfile not in expansion:
267 + continue
268 +
269 myout = commands.getstatusoutput("egrep -q "+headerstring+" "+myfile)
270 if myout[0] == 0:
271 myheaders.append(myfile)
272 @@ -1833,6 +1851,8 @@
273
274 if myupdates or myremoved:
275 myfiles = myupdates + myremoved
276 + if not myheaders and "sign" not in repoman_settings.features:
277 + myfiles += mymanifests
278 fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
279 mymsg = os.fdopen(fd, "w")
280 mymsg.write(commitmessage)
281 @@ -1919,8 +1939,8 @@
282 write_atomic(x, "".join(mylines))
283
284 manifest_commit_required = True
285 - if myheaders or myupdates or myremoved or mynew:
286 - myfiles=myheaders+myupdates+myremoved+mynew
287 + if myupdates or myremoved or mynew:
288 + myfiles=myupdates+myremoved+mynew
289 for x in range(len(myfiles)-1, -1, -1):
290 if myfiles[x].count("/") < 4-repolevel:
291 del myfiles[x]
292
293 Modified: main/branches/prefix/cnf/make.conf
294 ===================================================================
295 --- main/branches/prefix/cnf/make.conf 2008-08-03 19:14:53 UTC (rev 11321)
296 +++ main/branches/prefix/cnf/make.conf 2008-08-03 19:17:54 UTC (rev 11322)
297 @@ -245,61 +245,11 @@
298 # packages. Do not use it unless absolutely necessary!
299 #AUTOCLEAN="yes"
300 #
301 -# FEATURES are settings that affect the functionality of portage. Most of
302 -# these settings are for developer use, but some are available to non-
303 -# developers as well.
304 -#
305 -# 'buildpkg' causes binary packages to be created of all packages that
306 -# are being merged.
307 -# 'buildsyspkg' only build binary packages for system packages.
308 -# 'ccache' enable support for the dev-util/ccache package, which can
309 -# noticably decrease the time needed to remerge previously built
310 -# packages.
311 -# 'collision-protect'
312 -# prevents packages from overwriting files that are owned by
313 -# another package or by no package at all.
314 -# 'distcc' enables distcc support via CC.
315 -# 'distlocks' enables distfiles locking using fcntl or hardlinks. This
316 -# is enabled by default. Tools exist to help clean the locks
317 -# after crashes: /usr/lib/portage/bin/clean_locks.
318 -# 'installsources'
319 -# Install source code into /usr/src/debug/${CATEGORY}/${PF}
320 -# (also see 'splitdebug'). This feature works only if debugedit
321 -# is installed and CFLAGS is set to include debug information
322 -# (such as with the -ggdb flag).
323 -# 'test' causes ebuilds to perform testing phases if they are capable
324 -# of it. Some packages support this automatically via makefiles.
325 -# 'metadata-transfer'
326 -# automatically perform a metadata transfer when `emerge --sync`
327 -# is run.
328 -# 'noauto' causes ebuild to perform only the action requested and
329 -# not any other required actions like clean or unpack -- for
330 -# debugging purposes only.
331 -# 'nostrip' prevents the stripping of binaries.
332 -# 'notitles' disables xterm titlebar updates (which contain status info).
333 -# 'parallel-fetch'
334 -# do fetching in parallel to compilation
335 -# 'preserve-libs'
336 -# keep libraries around that would normally removed by an upgrade,
337 -# but are still needed by other packages
338 -# 'sandbox' enables sandboxing when running emerge and ebuild.
339 -# 'splitdebug' Prior to stripping ELF etdyn and etexec files, the debugging
340 -# info is stored for later use by various debuggers. This
341 -# feature is disabled by 'nostrip'. For installation of source
342 -# code, see 'installsources'.
343 -# 'strict' causes portage to react strongly to conditions that are
344 -# potentially dangerous, like missing/incorrect Manifest files.
345 -# 'stricter' causes portage to react strongly to conditions that may
346 -# conflict with system security provisions (for example
347 -# textrels, executable stacks).
348 -# 'userfetch' when portage is run as root, drop privileges to
349 -# portage:portage during the fetching of package sources.
350 -# 'userpriv' allows portage to drop root privileges while it is compiling,
351 -# as a security measure. As a side effect this can remove
352 -# sandbox access violations for users.
353 -# 'usersandbox' enables sandboxing while portage is running under userpriv.
354 -#FEATURES="sandbox buildpkg ccache distcc userpriv usersandbox notitles noauto"
355 -#FEATURES="sandbox ccache distcc distlocks"
356 +# FEATURES defines actions portage takes by default. This is an incremental
357 +# variable. See the make.conf(5) man page for a complete list of supported
358 +# values and their respective meanings.
359 +#FEATURES="ccache collision-protect distcc installsources \
360 +# splitdebug test userpriv usersandbox"
361
362 # CCACHE_SIZE and CCACHE_DIR are used to control the behavior of ccache, and
363 # and are only used if "ccache" is in FEATURES.
364
365 Modified: main/branches/prefix/cnf/make.conf.sparc-fbsd.diff
366 ===================================================================
367 --- main/branches/prefix/cnf/make.conf.sparc-fbsd.diff 2008-08-03 19:14:53 UTC (rev 11321)
368 +++ main/branches/prefix/cnf/make.conf.sparc-fbsd.diff 2008-08-03 19:17:54 UTC (rev 11322)
369 @@ -23,13 +23,3 @@
370
371 # Portage Directories
372 # ===================
373 -@@ -272,7 +286,8 @@
374 - # 'preserve-libs'
375 - # keep libraries around that would normally removed by an upgrade,
376 - # but are still needed by other packages
377 --# 'sandbox' enables sandboxing when running emerge and ebuild.
378 -+# 'sandbox' enables sandboxing when running emerge and ebuild. Doesn't
379 -+# work on *BSD-based systems.
380 - # 'splitdebug' Prior to stripping ELF etdyn and etexec files, the debugging
381 - # info is stored for later use by various debuggers. This
382 - # feature is disabled by 'nostrip'. For installation of source
383
384 Modified: main/branches/prefix/cnf/make.conf.x86-fbsd.diff
385 ===================================================================
386 --- main/branches/prefix/cnf/make.conf.x86-fbsd.diff 2008-08-03 19:14:53 UTC (rev 11321)
387 +++ main/branches/prefix/cnf/make.conf.x86-fbsd.diff 2008-08-03 19:17:54 UTC (rev 11322)
388 @@ -63,13 +63,3 @@
389
390 # Portage Directories
391 # ===================
392 -@@ -272,7 +313,8 @@
393 - # 'preserve-libs'
394 - # keep libraries around that would normally removed by an upgrade,
395 - # but are still needed by other packages
396 --# 'sandbox' enables sandboxing when running emerge and ebuild.
397 -+# 'sandbox' enables sandboxing when running emerge and ebuild. Doesn't
398 -+# work on *BSD-based systems.
399 - # 'splitdebug' Prior to stripping ELF etdyn and etexec files, the debugging
400 - # info is stored for later use by various debuggers. This
401 - # feature is disabled by 'nostrip'. For installation of source
402
403 Modified: main/branches/prefix/cnf/sets.conf
404 ===================================================================
405 --- main/branches/prefix/cnf/sets.conf 2008-08-03 19:14:53 UTC (rev 11321)
406 +++ main/branches/prefix/cnf/sets.conf 2008-08-03 19:17:54 UTC (rev 11322)
407 @@ -24,7 +24,10 @@
408 class = portage.sets.security.NewAffectedSet
409 world-candidate = False
410
411 -# Again, not much to change here, though people might prefer a different name
412 +# A superset of the classic <parameter>world</parameter> target, a set created
413 +# by this class contains SLOT atoms to match all installed packages. Note that
414 +# use of this set makes it impossible for emerge to solve blockers by automatic
415 +# uninstallation of blocked packages.
416 [installed]
417 class = portage.sets.dbapi.EverythingSet
418 world-candidate = False
419 @@ -44,9 +47,10 @@
420
421 # Installed ebuilds that inherit from known live eclasses.
422 [live-rebuild]
423 -class = portage.sets.dbapi.InheritSet
424 +class = portage.sets.dbapi.VariableSet
425 world-candidate = False
426 -inherits = cvs darcs git mercurial subversion
427 +variable = INHERITED
428 +includes = cvs darcs git mercurial subversion
429
430 # Installed packages that own files inside /lib/modules.
431 [module-rebuild]
432
433 Modified: main/branches/prefix/doc/config/sets.docbook
434 ===================================================================
435 --- main/branches/prefix/doc/config/sets.docbook 2008-08-03 19:14:53 UTC (rev 11321)
436 +++ main/branches/prefix/doc/config/sets.docbook 2008-08-03 19:17:54 UTC (rev 11322)
437 @@ -443,7 +443,9 @@
438 <title>portage.sets.dbapi.EverythingSet</title>
439 <para>
440 A superset of the classic <parameter>world</parameter> target, a set created
441 - by this class contains SLOT atoms to match all installed packages.
442 + by this class contains SLOT atoms to match all installed packages. Note that
443 + use of this set makes it impossible for emerge to solve blockers by automatic
444 + uninstallation of blocked packages.
445 </para>
446
447 <sect3>
448 @@ -453,29 +455,37 @@
449 </para>
450 </sect3>
451 </sect2>
452 - <sect2 id='config-set-classes-InheritSet'>
453 - <title>portage.sets.dbapi.InheritSet</title>
454 + <sect2 id='config-set-classes-OwnerSet'>
455 + <title>portage.sets.dbapi.OwnerSet</title>
456 <para>
457 Package set which contains all packages
458 - that inherit one or more specific eclasses.
459 + that own one or more files.
460 This class supports the following options:
461 <itemizedlist>
462 - <listitem><varname>inherits</varname>: Required. A list of eclass names
463 - which should be used to create the package set.
464 + <listitem><varname>files</varname>: Required. A list of file paths
465 + that should be used to create the package set.
466 </listitem>
467 </itemizedlist>
468 </para>
469 </sect2>
470 - <sect2 id='config-set-classes-OwnerSet'>
471 - <title>portage.sets.dbapi.OwnerSet</title>
472 + <sect2 id='config-set-classes-VariableSet'>
473 + <title>portage.sets.dbapi.VariableSet</title>
474 <para>
475 Package set which contains all packages
476 - that own one or more files.
477 + that match specified values of specified variable.
478 This class supports the following options:
479 <itemizedlist>
480 - <listitem><varname>files</varname>: Required. A list of file paths
481 - that should be used to create the package set.
482 + <listitem><varname>variable</varname>: The name of
483 + the specified variable whose values are checked.
484 </listitem>
485 + <listitem><varname>includes</varname>: A list of
486 + values that must be contained within the specified
487 + variable.
488 + </listitem>
489 + <listitem><varname>excludes</varname>: A list of
490 + values that must not be contained within the specified
491 + variable.
492 + </listitem>
493 </itemizedlist>
494 </para>
495 </sect2>
496 @@ -525,7 +535,7 @@
497 <listitem><varname>security</varname>: uses <classname>NewAffectedSet</classname> with default options</listitem>
498 <listitem><varname>everything</varname>: uses <classname>EverythingSet</classname></listitem>
499 <listitem><varname>preserved-rebuild</varname>: uses <classname>PreservedLibraryConsumerSet</classname></listitem>
500 - <listitem><varname>live-rebuild</varname>: uses <classname>InheritSet</classname></listitem>
501 + <listitem><varname>live-rebuild</varname>: uses <classname>VariableSet</classname></listitem>
502 <listitem><varname>module-rebuild</varname>: uses <classname>OwnerSet</classname></listitem>
503 <listitem><varname>downgrade</varname>: uses <classname>DowngradeSet</classname></listitem>
504 </itemizedlist>
505
506 Modified: main/branches/prefix/doc/dependency_resolution/task_scheduling.docbook
507 ===================================================================
508 --- main/branches/prefix/doc/dependency_resolution/task_scheduling.docbook 2008-08-03 19:14:53 UTC (rev 11321)
509 +++ main/branches/prefix/doc/dependency_resolution/task_scheduling.docbook 2008-08-03 19:17:54 UTC (rev 11322)
510 @@ -68,7 +68,13 @@
511 <sect1 id='dependency-resolution-task-scheduling-parallel'>
512 <title>Parallel Scheduling</title>
513 <para>
514 - TODO: Spawn an appropriate number of tasks in parallel when desired.
515 + The algorithm used to choose packages that will execute concurrently
516 + with other packages is as conservative as possible in the sense that
517 + a given package will not be executed if the subgraph composed of its
518 + direct and indirect dependencies contains any scheduled merges. By
519 + ensuring that the subgraph of deep dependencies is fully up to date
520 + in this way, potential problems are avoided which could be triggered
521 + by other build orders that are less optimal.
522 </para>
523 </sect1>
524 </chapter>
525
526 Modified: main/branches/prefix/man/make.conf.5
527 ===================================================================
528 --- main/branches/prefix/man/make.conf.5 2008-08-03 19:14:53 UTC (rev 11321)
529 +++ main/branches/prefix/man/make.conf.5 2008-08-03 19:17:54 UTC (rev 11322)
530 @@ -143,10 +143,10 @@
531 script arguments (see \fBebuild\fR(5)).
532 .TP
533 \fBFEATURES\fR = \fI"sandbox ccache"\fR
534 -Defines actions portage takes by default. These options should
535 -not be changed by anyone but developers and/or maintainers. 'sandbox' is an important
536 -part of \fBFEATURES\fR and should not be disabled by default. This is
537 -an incremental variable.
538 +Defines actions portage takes by default. This is an incremental variable.
539 +Most of these settings are for developer use, but some are available to
540 +non-developers as well. The \fBsandbox\fR feature is very important and
541 +should not be disabled by default.
542 .RS
543 .TP
544 .B assume\-digests
545
546 Modified: main/branches/prefix/pym/_emerge/__init__.py
547 ===================================================================
548 --- main/branches/prefix/pym/_emerge/__init__.py 2008-08-03 19:14:53 UTC (rev 11321)
549 +++ main/branches/prefix/pym/_emerge/__init__.py 2008-08-03 19:17:54 UTC (rev 11322)
550 @@ -2254,7 +2254,7 @@
551
552 class EbuildFetcher(SpawnProcess):
553
554 - __slots__ = ("fetchonly", "pkg",)
555 + __slots__ = ("fetchonly", "fetchall", "pkg",)
556
557 def _start(self):
558
559 @@ -2262,8 +2262,16 @@
560 portdb = root_config.trees["porttree"].dbapi
561 ebuild_path = portdb.findname(self.pkg.cpv)
562 settings = root_config.settings
563 + phase = "fetch"
564 + if self.fetchall:
565 + phase = "fetchall"
566
567 - fetch_env = dict(settings.iteritems())
568 + # If any incremental variables have been overridden
569 + # via the environment, those values need to be passed
570 + # along here so that they are correctly considered by
571 + # the config instance in the subproccess.
572 + fetch_env = os.environ.copy()
573 +
574 fetch_env["PORTAGE_NICENESS"] = "0"
575 if self.fetchonly:
576 fetch_env["PORTAGE_PARALLEL_FETCHONLY"] = "1"
577 @@ -2271,7 +2279,7 @@
578 ebuild_binary = os.path.join(
579 settings["PORTAGE_BIN_PATH"], "ebuild")
580
581 - fetch_args = [ebuild_binary, ebuild_path, "fetch"]
582 + fetch_args = [ebuild_binary, ebuild_path, phase]
583 debug = settings.get("PORTAGE_DEBUG") == "1"
584 if debug:
585 fetch_args.append("--debug")
586 @@ -2423,7 +2431,8 @@
587 if self.background:
588 fetch_log = self.scheduler.fetch.log_file
589
590 - fetcher = EbuildFetcher(fetchonly=opts.fetchonly,
591 + fetcher = EbuildFetcher(fetchall=opts.fetch_all_uri,
592 + fetchonly=opts.fetchonly,
593 background=self.background, logfile=fetch_log,
594 pkg=pkg, scheduler=self.scheduler)
595
596 @@ -4647,25 +4656,30 @@
597 return 0
598 if debug:
599 print "Candidates:", selected_atoms
600 +
601 for atom in selected_atoms:
602 - if isinstance(atom, basestring) \
603 - and not portage.isvalidatom(atom):
604 + try:
605 +
606 + blocker = atom.startswith("!")
607 + if blocker:
608 + atom = atom[1:]
609 + mypriority = dep_priority.copy()
610 + if not blocker and vardb.match(atom):
611 + mypriority.satisfied = True
612 +
613 + if not self._add_dep(Dependency(atom=atom,
614 + blocker=blocker, depth=depth, parent=pkg,
615 + priority=mypriority, root=dep_root),
616 + allow_unsatisfied=allow_unsatisfied):
617 + return 0
618 +
619 + except portage.exception.InvalidAtom, e:
620 show_invalid_depstring_notice(
621 - pkg, dep_string, str(atom))
622 + pkg, dep_string, str(e))
623 + del e
624 if not pkg.installed:
625 return 0
626 - continue
627 - blocker = atom.startswith("!")
628 - if blocker:
629 - atom = atom[1:]
630 - mypriority = dep_priority.copy()
631 - if not blocker and vardb.match(atom):
632 - mypriority.satisfied = True
633 - if not self._add_dep(Dependency(atom=atom,
634 - blocker=blocker, depth=depth, parent=pkg,
635 - priority=mypriority, root=dep_root),
636 - allow_unsatisfied=allow_unsatisfied):
637 - return 0
638 +
639 if debug:
640 print "Exiting...", jbigkey
641 except ValueError, e:
642 @@ -10398,6 +10412,7 @@
643 # we don't want to unmerge packages that are still listed in user-editable package sets
644 # listed in "world" as they would be remerged on the next update of "world" or the
645 # relevant package sets.
646 + unknown_sets = set()
647 for cp in xrange(len(pkgmap)):
648 for cpv in pkgmap[cp]["selected"].copy():
649 try:
650 @@ -10413,6 +10428,17 @@
651 # removed from "world" later on)
652 if s in root_config.setconfig.active or (s == "world" and not root_config.setconfig.active):
653 continue
654 +
655 + if s not in sets:
656 + if s in unknown_sets:
657 + continue
658 + unknown_sets.add(s)
659 + out = portage.output.EOutput()
660 + out.eerror(("Unknown set '@%s' in " + \
661 + "%svar/lib/portage/world_sets") % \
662 + (s, root_config.root))
663 + continue
664 +
665 # only check instances of EditablePackageSet as other classes are generally used for
666 # special purposes and can be ignored here (and are usually generated dynamically, so the
667 # user can't do much about them anyway)
668 @@ -13489,6 +13515,9 @@
669 "--usepkg", "--usepkgonly"):
670 myopts.pop(opt, None)
671
672 + if "--fetch-all-uri" in myopts:
673 + myopts["--fetchonly"] = True
674 +
675 if "--skipfirst" in myopts and "--resume" not in myopts:
676 myopts["--resume"] = True
677
678
679 Modified: main/branches/prefix/pym/portage/__init__.py
680 ===================================================================
681 --- main/branches/prefix/pym/portage/__init__.py 2008-08-03 19:14:53 UTC (rev 11321)
682 +++ main/branches/prefix/pym/portage/__init__.py 2008-08-03 19:17:54 UTC (rev 11322)
683 @@ -5111,7 +5111,8 @@
684
685 clean_phases = ("clean", "cleanrm")
686 validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
687 - "config","info","setup","depend","fetch","digest",
688 + "config", "info", "setup", "depend",
689 + "fetch", "fetchall", "digest",
690 "unpack","compile","test","install","rpm","qmerge","merge",
691 "package","unmerge", "manifest"]
692
693 @@ -5126,6 +5127,10 @@
694 writemsg("\n", noiselevel=-1)
695 return 1
696
697 + if mydo == "fetchall":
698 + fetchall = 1
699 + mydo = "fetch"
700 +
701 if mydo not in clean_phases and not os.path.exists(myebuild):
702 writemsg("!!! doebuild: %s not found for %s\n" % (myebuild, mydo),
703 noiselevel=-1)
704
705 Modified: main/branches/prefix/pym/portage/cache/mappings.py
706 ===================================================================
707 --- main/branches/prefix/pym/portage/cache/mappings.py 2008-08-03 19:14:53 UTC (rev 11321)
708 +++ main/branches/prefix/pym/portage/cache/mappings.py 2008-08-03 19:17:54 UTC (rev 11322)
709 @@ -262,6 +262,9 @@
710 except AttributeError:
711 pass
712
713 + def __str__(self):
714 + return str(dict(self.iteritems()))
715 +
716 v = SlotDict
717 _slot_dict_classes[v.allowed_keys] = v
718 return v
719
720 Modified: main/branches/prefix/pym/portage/dbapi/bintree.py
721 ===================================================================
722 --- main/branches/prefix/pym/portage/dbapi/bintree.py 2008-08-03 19:14:53 UTC (rev 11321)
723 +++ main/branches/prefix/pym/portage/dbapi/bintree.py 2008-08-03 19:17:54 UTC (rev 11322)
724 @@ -774,9 +774,6 @@
725 noiselevel=-1)
726 return
727 slot = slot.strip()
728 - from portage.checksum import perform_multiple_checksums
729 - digests = perform_multiple_checksums(
730 - full_path, hashes=self._pkgindex_hashes)
731 self.dbapi.cpv_inject(cpv)
732 self.dbapi._aux_cache.pop(cpv, None)
733
734 @@ -807,26 +804,16 @@
735 del f
736 if not self._pkgindex_version_supported(pkgindex):
737 pkgindex = self._new_pkgindex()
738 - d = digests
739 - d["CPV"] = cpv
740 - d["SLOT"] = slot
741 - d["MTIME"] = str(long(s.st_mtime))
742 - d["SIZE"] = str(s.st_size)
743 - rel_path = self._pkg_paths[cpv]
744 - # record location if it's non-default
745 - if rel_path != cpv + ".tbz2":
746 - d["PATH"] = rel_path
747 - from itertools import izip
748 - d.update(izip(self._pkgindex_aux_keys,
749 - self.dbapi.aux_get(cpv, self._pkgindex_aux_keys)))
750 +
751 try:
752 - self._eval_use_flags(cpv, d)
753 + d = self._pkgindex_entry(cpv)
754 except portage.exception.InvalidDependString:
755 writemsg("!!! Invalid binary package: '%s'\n" % \
756 self.getname(cpv), noiselevel=-1)
757 self.dbapi.cpv_remove(cpv)
758 del self._pkg_paths[cpv]
759 return
760 +
761 # If found, remove package(s) with duplicate path.
762 for i in xrange(len(pkgindex.packages) - 1, -1, -1):
763 d2 = pkgindex.packages[i]
764 @@ -835,6 +822,7 @@
765 if d2.get("PATH", "") == d.get("PATH", ""):
766 del pkgindex.packages[i]
767 pkgindex.packages.append(d)
768 +
769 self._update_pkgindex_header(pkgindex.header)
770 from portage.util import atomic_ofstream
771 f = atomic_ofstream(os.path.join(self.pkgdir, "Packages"))
772 @@ -846,6 +834,36 @@
773 if pkgindex_lock:
774 unlockfile(pkgindex_lock)
775
776 + def _pkgindex_entry(self, cpv):
777 + """
778 + Performs checksums and evaluates USE flag conditionals.
779 + Raises InvalidDependString if necessary.
780 + @rtype: dict
781 + @returns: a dict containing entry for the give cpv.
782 + """
783 +
784 + pkg_path = self.getname(cpv)
785 + from portage.checksum import perform_multiple_checksums
786 +
787 + d = dict(izip(self._pkgindex_aux_keys,
788 + self.dbapi.aux_get(cpv, self._pkgindex_aux_keys)))
789 +
790 + d.update(perform_multiple_checksums(
791 + pkg_path, hashes=self._pkgindex_hashes))
792 +
793 + d["CPV"] = cpv
794 + st = os.stat(pkg_path)
795 + d["MTIME"] = str(long(st.st_mtime))
796 + d["SIZE"] = str(st.st_size)
797 +
798 + rel_path = self._pkg_paths[cpv]
799 + # record location if it's non-default
800 + if rel_path != cpv + ".tbz2":
801 + d["PATH"] = rel_path
802 +
803 + self._eval_use_flags(cpv, d)
804 + return d
805 +
806 def _new_pkgindex(self):
807 return portage.getbinpkg.PackageIndex(
808 allowed_pkg_keys=self._pkgindex_allowed_pkg_keys,
809
810 Modified: main/branches/prefix/pym/portage/dbapi/vartree.py
811 ===================================================================
812 --- main/branches/prefix/pym/portage/dbapi/vartree.py 2008-08-03 19:14:53 UTC (rev 11321)
813 +++ main/branches/prefix/pym/portage/dbapi/vartree.py 2008-08-03 19:17:54 UTC (rev 11322)
814 @@ -486,7 +486,7 @@
815 self.vartree = vartree
816 self._aux_cache_keys = set(
817 ["CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
818 - "EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
819 + "EAPI", "HOMEPAGE", "INHERITED", "IUSE", "KEYWORDS",
820 "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND",
821 "repository", "RESTRICT" , "SLOT", "USE"])
822 self._aux_cache_obj = None
823 @@ -922,7 +922,7 @@
824 cache_valid = cache_mtime == mydir_mtime
825 if cache_valid:
826 mydata.update(metadata)
827 - pull_me.difference_update(metadata)
828 + pull_me.difference_update(mydata)
829
830 if pull_me:
831 # pull any needed data and cache it
832 @@ -2837,10 +2837,14 @@
833 # it may not be visible via a scrollback buffer, especially
834 # if the number of file collisions is large. Therefore,
835 # show a summary at the end.
836 - msg = ("Package '%s' NOT merged due to " + \
837 - "file collisions. If necessary, refer to your elog " + \
838 - "messages for the whole content of the above message.") % \
839 - self.settings.mycpv
840 + if collision_protect:
841 + msg = "Package '%s' NOT merged due to file collisions." % \
842 + self.settings.mycpv
843 + else:
844 + msg = "Package '%s' merged despite file collisions." % \
845 + self.settings.mycpv
846 + msg += " If necessary, refer to your elog " + \
847 + "messages for the whole content of the above message."
848 eerror(wrap(msg, 70))
849
850 if collision_protect:
851
852 Modified: main/branches/prefix/pym/portage/sets/dbapi.py
853 ===================================================================
854 --- main/branches/prefix/pym/portage/sets/dbapi.py 2008-08-03 19:14:53 UTC (rev 11321)
855 +++ main/branches/prefix/pym/portage/sets/dbapi.py 2008-08-03 19:17:54 UTC (rev 11322)
856 @@ -3,29 +3,50 @@
857 # $Id$
858
859 from portage.versions import catpkgsplit, catsplit, pkgcmp
860 +from portage.dep import Atom
861 from portage.sets.base import PackageSet
862 from portage.sets import SetConfigError, get_boolean
863
864 -__all__ = ["CategorySet", "EverythingSet", "InheritSet"]
865 +__all__ = ["CategorySet", "DowngradeSet",
866 + "EverythingSet", "OwnerSet", "VariableSet"]
867
868 class EverythingSet(PackageSet):
869 _operations = ["merge", "unmerge"]
870 description = "Package set which contains SLOT " + \
871 "atoms to match all installed packages"
872 + _filter = None
873
874 def __init__(self, vdbapi):
875 super(EverythingSet, self).__init__()
876 self._db = vdbapi
877 -
878 +
879 def load(self):
880 myatoms = []
881 + db_keys = ["SLOT"]
882 + aux_get = self._db.aux_get
883 + cp_list = self._db.cp_list
884 +
885 for cp in self._db.cp_all():
886 - if len(self._db.cp_list(cp)) > 1:
887 - for cpv in self._db.cp_list(cp):
888 - myslot = self._db.aux_get(cpv, ["SLOT"])[0]
889 - myatoms.append(cp+":"+myslot)
890 + cpv_list = cp_list(cp)
891 +
892 + if len(cpv_list) > 1:
893 + for cpv in cpv_list:
894 + slot, = aux_get(cpv, db_keys)
895 + atom = Atom("%s:%s" % (cp, slot))
896 + if self._filter:
897 + if self._filter(atom):
898 + myatoms.append(atom)
899 + else:
900 + myatoms.append(atom)
901 +
902 else:
903 - myatoms.append(cp)
904 + atom = Atom(cp)
905 + if self._filter:
906 + if self._filter(atom):
907 + myatoms.append(atom)
908 + else:
909 + myatoms.append(atom)
910 +
911 self._setAtoms(myatoms)
912
913 def singleBuilder(self, options, settings, trees):
914 @@ -68,41 +89,50 @@
915
916 singleBuilder = classmethod(singleBuilder)
917
918 -class InheritSet(PackageSet):
919 +class VariableSet(EverythingSet):
920
921 _operations = ["merge", "unmerge"]
922
923 description = "Package set which contains all packages " + \
924 - "that inherit one or more specific eclasses."
925 + "that match specified values of a specified variable."
926
927 - def __init__(self, vardb=None, inherits=None):
928 - super(InheritSet, self).__init__()
929 - self._db = vardb
930 - self._inherits = inherits
931 + def __init__(self, vardb, portdb=None, variable=None, includes=None, excludes=None):
932 + super(VariableSet, self).__init__(vardb)
933 + self._portdb = portdb
934 + self._variable = variable
935 + self._includes = includes
936 + self._excludes = excludes
937
938 - def load(self):
939 - atoms = []
940 - inherits = self._inherits
941 - cp_list = self._db.cp_list
942 - aux_get = self._db.aux_get
943 - aux_keys = ["INHERITED", "SLOT"]
944 - for cp in self._db.cp_all():
945 - for cpv in cp_list(cp):
946 - inherited, slot = aux_get(cpv, aux_keys)
947 - inherited = inherited.split()
948 - if inherits.intersection(inherited):
949 - atoms.append("%s:%s" % (cp, slot))
950 + def _filter(self, atom):
951 + ebuild = self._portdb.xmatch("bestmatch-visible", atom)
952 + if not ebuild:
953 + return False
954 + values, = self._portdb.aux_get(ebuild, [self._variable])
955 + values = values.split()
956 + if self._includes and not self._includes.intersection(values):
957 + return False
958 + if self._excludes and self._excludes.intersection(values):
959 + return False
960 + return True
961
962 - self._setAtoms(atoms)
963 -
964 def singleBuilder(cls, options, settings, trees):
965 - if not "inherits" in options:
966 - raise SetConfigError("no inherits given")
967
968 - inherits = options["inherits"]
969 - return cls(vardb=trees["vartree"].dbapi,
970 - inherits=frozenset(inherits.split()))
971 + variable = options.get("variable")
972 + if variable is None:
973 + raise SetConfigError("missing required attribute: 'variable'")
974
975 + includes = options.get("includes", "")
976 + excludes = options.get("excludes", "")
977 +
978 + if not (includes or excludes):
979 + raise SetConfigError("no includes or excludes given")
980 +
981 + return cls(trees["vartree"].dbapi,
982 + portdb=trees["porttree"].dbapi,
983 + excludes=frozenset(excludes.split()),
984 + includes=frozenset(includes.split()),
985 + variable=variable)
986 +
987 singleBuilder = classmethod(singleBuilder)
988
989 class DowngradeSet(PackageSet):
990
991 Modified: main/branches/prefix/pym/portage/sets/profiles.py
992 ===================================================================
993 --- main/branches/prefix/pym/portage/sets/profiles.py 2008-08-03 19:14:53 UTC (rev 11321)
994 +++ main/branches/prefix/pym/portage/sets/profiles.py 2008-08-03 19:17:54 UTC (rev 11322)
995 @@ -2,9 +2,12 @@
996 # Distributed under the terms of the GNU General Public License v2
997 # $Id$
998
999 +import logging
1000 import os
1001 from portage.util import grabfile_package, stack_lists
1002 from portage.sets.base import PackageSet
1003 +from portage.sets import get_boolean
1004 +from portage.util import writemsg_level
1005 from portage.const import EPREFIX
1006
1007 __all__ = ["PackagesSystemSet"]
1008 @@ -12,9 +15,10 @@
1009 class PackagesSystemSet(PackageSet):
1010 _operations = ["merge"]
1011
1012 - def __init__(self, profile_paths):
1013 + def __init__(self, profile_paths, debug=False):
1014 super(PackagesSystemSet, self).__init__()
1015 self._profile_paths = profile_paths
1016 + self._debug = debug
1017 if profile_paths:
1018 description = self._profile_paths[-1]
1019 if description == EPREFIX+"/etc/portage/profile" and \
1020 @@ -25,10 +29,26 @@
1021 self.description = "System packages for profile %s" % description
1022
1023 def load(self):
1024 + debug = self._debug
1025 + if debug:
1026 + writemsg_level("\nPackagesSystemSet: profile paths: %s\n" % \
1027 + (self._profile_paths,), level=logging.DEBUG, noiselevel=-1)
1028 +
1029 mylist = [grabfile_package(os.path.join(x, "packages")) for x in self._profile_paths]
1030 +
1031 + if debug:
1032 + writemsg_level("\nPackagesSystemSet: raw packages: %s\n" % \
1033 + (mylist,), level=logging.DEBUG, noiselevel=-1)
1034 +
1035 mylist = stack_lists(mylist, incremental=1)
1036 +
1037 + if debug:
1038 + writemsg_level("\nPackagesSystemSet: stacked packages: %s\n" % \
1039 + (mylist,), level=logging.DEBUG, noiselevel=-1)
1040 +
1041 self._setAtoms([x[1:] for x in mylist if x[0] == "*"])
1042
1043 def singleBuilder(self, options, settings, trees):
1044 - return PackagesSystemSet(settings.profiles)
1045 + debug = get_boolean(options, "debug", False)
1046 + return PackagesSystemSet(settings.profiles, debug=debug)
1047 singleBuilder = classmethod(singleBuilder)