Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13278 - in main/branches/prefix: bin man pym/_emerge pym/portage
Date: Thu, 02 Apr 2009 13:06:45
Message-Id: E1LpMd0-0005aY-Mt@stork.gentoo.org
1 Author: grobian
2 Date: 2009-04-02 13:06:41 +0000 (Thu, 02 Apr 2009)
3 New Revision: 13278
4
5 Added:
6 main/branches/prefix/man/egencache.1
7 Modified:
8 main/branches/prefix/bin/ebuild.sh
9 main/branches/prefix/bin/egencache
10 main/branches/prefix/bin/isolated-functions.sh
11 main/branches/prefix/man/Makefile.am
12 main/branches/prefix/man/ebuild.1
13 main/branches/prefix/man/emerge.1
14 main/branches/prefix/pym/_emerge/__init__.py
15 main/branches/prefix/pym/_emerge/help.py
16 main/branches/prefix/pym/portage/__init__.py
17 Log:
18 Merged from trunk -r13262:13275
19
20 | 13263 | Add parsing code for --jobs and --load-average. |
21 | zmedico | |
22
23 | 13264 | Fix typo in comment. |
24 | zmedico | |
25
26 | 13265 | Automatically enable FEATURES=metadata-transfer if it's not |
27 | zmedico | enabled, instead of bailing out. |
28
29 | 13266 | Add support for a EGENCACHE_DEFAULT_OPTS variable in |
30 | zmedico | make.conf. |
31
32 | 13267 | Combine the --rdeps-only and --root-deps options into a |
33 | zmedico | single --root-deps option which takes an optional 'rdeps' |
34 | | argument. |
35
36 | 13268 | Clarify docs for --root-deps. |
37 | zmedico | |
38
39 | 13269 | Document new prepare and configure commands for EAPI 2. |
40 | zmedico | |
41
42 | 13270 | Add a man page for egencache(1). |
43 | zmedico | |
44
45 | 13271 | Allow --root-deps for ROOT=/, so people can do weird things |
46 | zmedico | like use it with -e to remerge deep runtime deps without |
47 | | pulling in build-time deps. It's not something we really |
48 | | want to advertise, but it's good to leave the option open in |
49 | | case it happens to be useful. Thanks to Ned Ludd <solar@g.o> |
50 | | for the suggestion. |
51
52 | 13272 | Remove the ATOMS section and move --update to a new ACTIONS |
53 | zmedico | section. |
54
55 | 13273 | Bug #264494 - In case the ebuild has enabled set -e during |
56 | zmedico | an ebuild phase, proactively call set +e inside qa_source(), |
57 | | qa_call(), and die(). |
58
59 | 13274 | - Add more info to the DESCRIPTION section. - Add a BUGS |
60 | zmedico | section to explain issues related to limitations in the |
61 | | cache format and its validation mechanism. |
62
63 | 13275 | Note that only updates to PORTDIR are currently supported. |
64 | zmedico | |
65
66
67 Modified: main/branches/prefix/bin/ebuild.sh
68 ===================================================================
69 --- main/branches/prefix/bin/ebuild.sh 2009-04-02 13:02:59 UTC (rev 13277)
70 +++ main/branches/prefix/bin/ebuild.sh 2009-04-02 13:06:41 UTC (rev 13278)
71 @@ -35,6 +35,7 @@
72 local retval
73 source "$@"
74 retval=$?
75 + set +e
76 [[ $shopts != $(shopt) ]] &&
77 eqawarn "QA Notice: Global shell options changed and were not restored while sourcing '$*'"
78 [[ "$IFS" != "$OLDIFS" ]] &&
79 @@ -47,6 +48,7 @@
80 local retval
81 "$@"
82 retval=$?
83 + set +e
84 [[ $shopts != $(shopt) ]] &&
85 eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
86 [[ "$IFS" != "$OLDIFS" ]] &&
87
88 Modified: main/branches/prefix/bin/egencache
89 ===================================================================
90 --- main/branches/prefix/bin/egencache 2009-04-02 13:02:59 UTC (rev 13277)
91 +++ main/branches/prefix/bin/egencache 2009-04-02 13:06:41 UTC (rev 13278)
92 @@ -50,12 +50,42 @@
93 action="store_true",
94 help="enable rsync stat collision workaround " + \
95 "for bug 139134 (use with --update)")
96 + parser.add_option("--ignore-default-opts",
97 + action="store_true",
98 + help="do not use the EGENCACHE_DEFAULT_OPTS environment variable")
99 options, args = parser.parse_args(args)
100
101 - if not options.update:
102 - parser.error('No action specified (--update ' + \
103 - 'is the only available action)')
104 + if options.jobs:
105 + jobs = None
106 + try:
107 + jobs = int(options.jobs)
108 + except ValueError:
109 + jobs = -1
110
111 + if jobs < 1:
112 + parser.error("Invalid: --jobs='%s'" % \
113 + (options.jobs,))
114 +
115 + options.jobs = jobs
116 +
117 + else:
118 + options.jobs = None
119 +
120 + if options.load_average:
121 + try:
122 + load_average = float(options.load_average)
123 + except ValueError:
124 + load_average = 0.0
125 +
126 + if load_average <= 0.0:
127 + parser.error("Invalid: --load-average='%s'" % \
128 + (options.load_average,))
129 +
130 + options.load_average = load_average
131 +
132 + else:
133 + options.load_average = None
134 +
135 if options.config_root is not None and \
136 not os.path.isdir(options.config_root):
137 parser.error("Not a directory: --config-root='%s'" % \
138 @@ -74,7 +104,7 @@
139 if str(atom) != atom.cp:
140 parser.error('Atom is too specific: %s' % (atom,))
141
142 - return options, args
143 + return parser, options, args
144
145 class GenCache(object):
146 def __init__(self, portdb, cp_iter=None, max_jobs=None, max_load=None,
147 @@ -112,7 +142,7 @@
148 # file mtime nor size changes, it will prevent rsync from
149 # detecting changes. Cache backends may raise this
150 # exception from _setitem() if they detect this type of stat
151 - # collision. These exceptions are be handled by bumping the
152 + # collision. These exceptions are handled by bumping the
153 # mtime on the ebuild (and the corresponding cache entry).
154 # See bug #139134.
155 max_mtime = sc.mtime
156 @@ -192,7 +222,7 @@
157 level=logging.ERROR, noiselevel=-1)
158
159 def egencache_main(args):
160 - options, args = parse_args(args)
161 + parser, options, atoms = parse_args(args)
162
163 config_root = options.config_root
164 if config_root is None:
165 @@ -211,17 +241,42 @@
166 settings = portage.config(config_root=config_root,
167 target_root='/', env=env)
168
169 - if 'metadata-transfer' not in settings.features:
170 - writemsg_level("ecachegen: error: " + \
171 - "FEATURES=metadata-transfer is not enabled\n",
172 - level=logging.ERROR, noiselevel=-1)
173 + default_opts = None
174 + if not options.ignore_default_opts:
175 + default_opts = settings.get('EGENCACHE_DEFAULT_OPTS', '').split()
176 +
177 + if default_opts:
178 + parser, options, args = parse_args(default_opts + args)
179 +
180 + if options.config_root is not None:
181 + config_root = options.config_root
182 +
183 + if options.cache_dir is not None:
184 + env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
185 +
186 + settings = portage.config(config_root=config_root,
187 + target_root='/', env=env)
188 +
189 + if not options.update:
190 + parser.error('No action specified (--update ' + \
191 + 'is the only available action)')
192 return 1
193
194 + if 'metadata-transfer' not in settings.features:
195 + writemsg_level("ecachegen: warning: " + \
196 + "automatically enabling FEATURES=metadata-transfer\n",
197 + level=logging.WARNING, noiselevel=-1)
198 + settings.features.add('metadata-transfer')
199 + settings['FEATURES'] = ' '.join(sorted(settings.features))
200 + settings.backup_changes('FEATURES')
201 +
202 + settings.lock()
203 +
204 portdb = portage.portdbapi(settings["PORTDIR"], mysettings=settings)
205
206 cp_iter = None
207 - if args:
208 - cp_iter = iter(args)
209 + if atoms:
210 + cp_iter = iter(atoms)
211
212 gen_cache = GenCache(portdb, cp_iter=cp_iter,
213 max_jobs=options.jobs,
214
215 Modified: main/branches/prefix/bin/isolated-functions.sh
216 ===================================================================
217 --- main/branches/prefix/bin/isolated-functions.sh 2009-04-02 13:02:59 UTC (rev 13277)
218 +++ main/branches/prefix/bin/isolated-functions.sh 2009-04-02 13:06:41 UTC (rev 13278)
219 @@ -54,6 +54,7 @@
220 }
221
222 die() {
223 + set +e
224 if [ -n "${QA_INTERCEPTORS}" ] ; then
225 # die was called from inside inherit. We need to clean up
226 # QA_INTERCEPTORS since sed is called below.
227
228 Modified: main/branches/prefix/man/Makefile.am
229 ===================================================================
230 --- main/branches/prefix/man/Makefile.am 2009-04-02 13:02:59 UTC (rev 13277)
231 +++ main/branches/prefix/man/Makefile.am 2009-04-02 13:06:41 UTC (rev 13278)
232 @@ -4,6 +4,7 @@
233 dispatch-conf.1 \
234 ebuild.1 \
235 ebuild.5 \
236 + egencache.1 \
237 emaint.1 \
238 emerge.1 \
239 env-update.1 \
240
241 Modified: main/branches/prefix/man/ebuild.1
242 ===================================================================
243 --- main/branches/prefix/man/ebuild.1 2009-04-02 13:02:59 UTC (rev 13277)
244 +++ main/branches/prefix/man/ebuild.1 2009-04-02 13:06:41 UTC (rev 13278)
245 @@ -93,6 +93,18 @@
246 making the appropriate patches to the sources so that they're ready
247 for compilation.
248 .TP
249 +.BR prepare
250 +Prepares the extracted sources by running the \fIsrc_prepare()\fR
251 +function specified in the ebuild file. When src_prepare() starts, the
252 +current working directory will be set to ${S}. This function is supported
253 +beginning with \fBEAPI 2\fR.
254 +.TP
255 +.BR configure
256 +Configures the extracted sources by running the \fIsrc_configure()\fR
257 +function specified in the ebuild file. When src_configure() starts, the
258 +current working directory will be set to ${S}. This function is supported
259 +beginning with \fBEAPI 2\fR.
260 +.TP
261 .BR compile
262 Compiles the extracted sources by running the \fIsrc_compile()\fR
263 function specified in the ebuild file. When src_compile() starts, the
264
265 Copied: main/branches/prefix/man/egencache.1 (from rev 13275, main/trunk/man/egencache.1)
266 ===================================================================
267 --- main/branches/prefix/man/egencache.1 (rev 0)
268 +++ main/branches/prefix/man/egencache.1 2009-04-02 13:06:41 UTC (rev 13278)
269 @@ -0,0 +1,98 @@
270 +.TH "EGENCACHE" "1" "March 2009" "Portage 2.2" "Portage"
271 +.SH "NAME"
272 +egencache \- generate metadata cache for ebuild repositories
273 +.SH "SYNOPSIS"
274 +.B egencache
275 +.I [options] --update [ATOM]\fR...
276 +.SH "DESCRIPTION"
277 +The egencache program generates metadata cache for ebuild repositories and
278 +stores it in the \fImetadata/cache/\fR directory within the repository itself,
279 +for distribution. Currenly, only the repository located at \fBPORTDIR\fR
280 +(configured in \fBmake.conf(5)\fR) can be updated by this program, but a
281 +future version will have the ability to select a different repository.
282 +.SH ACTIONS
283 +.TP
284 +.BR "\-\-update [ATOM] ... "
285 +Update the \fImetadata/cache/\fR directory (generate metadata as necessary).
286 +If no package atoms are specified then all will be updated. See ebuild(5)
287 +for the details on package atom syntax.
288 +.SH OPTIONS
289 +.TP
290 +.BR "\-\-cache\-dir=CACHE_DIR"
291 +Location of the intermediate metadata cache which is stored in a different
292 +format that includes eclass state. See the \fBBUGS\fR section for
293 +information about why this is necessary.
294 +.br
295 +Defaults to /var/cache/edb/dep.
296 +.TP
297 +.BR "\-\-config\-root=CONFIG_ROOT"
298 +Location of portage config files.
299 +.br
300 +Defaults to /.
301 +.TP
302 +.BR "\-\-ignore-default-opts"
303 +Causes \fIEGENCACHE_DEFAULT_OPTS\fR to be ignored.
304 +.TP
305 +.BR "\-\-jobs=JOBS"
306 +Specifies the maximum number of ebuild processes to spawn simultaneously.
307 +Also see the related \fB\-\-load\-average\fR option.
308 +.TP
309 +.BR \-\-load\-average=LOAD
310 +Specifies that maximum load allowed when spawning multiple jobs.
311 +.TP
312 +.BR "\-\-rsync"
313 +When used together with the \fB\-\-update\fR action, this enables a workaround
314 +for cases in which the content of a cache entry changes and neither the file
315 +mtime nor size changes, preventing rsync from detecting changes. Such cases are
316 +handled by bumping the mtime on the ebuild (and the corresponding cache entry).
317 +This option should only be needed for distribution via something like
318 +\fBrsync\fR(1), which relies on timestamps and file sizes to detect changes
319 +(see \fBbug 139134\fR). It's not needed with \fBgit\fR(1) since that uses a
320 +more thorough mechanism which allows it to detect changed inode numbers
321 +(described in \fIracy-git.txt\fR in the git technical docs).
322 +.SH "ENVIRONMENT OPTIONS"
323 +.TP
324 +\fBEGENCACHE_DEFAULT_OPTS\fR
325 +If this variable is set in \fBmake.conf\fR(5) then any options that it
326 +contains will be added to the beginning of the command line on every
327 +invocation. These options will not be added if the
328 +\fB\-\-ignore-default\-opts\fR option is specified.
329 +.SH "BUGS"
330 +There are significant limitations associated with the metadata
331 +cache format that is distributed in the \fImetadata/cache/\fR directory
332 +of the repository. These limitations are related to the cache validation
333 +mechanism. Currently, the validation mechanism involves comparison of
334 +a cache entry mtime to the mtime of the corresponding \fBebuild(5)\fR. This
335 +mechanism is unreliable in cases when eclass changes result in metadata
336 +changes, since no information about eclass state is available in the cache.
337 +Also, since the mtime of the cache entry must correspond to that of the
338 +ebuild, the cache format is only suitable for distribution via protocols
339 +that preserve timestamps (such as \fBrsync(1))\fR. For cache that is
340 +distributed via \fBgit(1)\fR repositories, there is currently a workaround
341 +implemented in \fBemerge\fR(1) \fB\-\-sync\fR which updates ebuild mtimes
342 +to match their corresponding cache entries (except for ebuilds that are
343 +modified relative to HEAD).
344 +
345 +In order to solve the above problems, a future extension
346 +to the cache format will include additional
347 +validation data in the form of digests for both the ebuild
348 +and its inherited eclasses. Until the
349 +cache format has been extended in this way, it is necessary to enable
350 +\fBmetadata-transfer\fR in \fBFEATURES\fR (see \fBmake.conf(5)\fR).
351 +This causes intermediate cache (in a different format that includes
352 +eclass state) to be generated inside the directory which is configurable
353 +via the \fB\-\-cache\-dir\fR option.
354 +.SH "REPORTING BUGS"
355 +Please report bugs via http://bugs.gentoo.org/
356 +.SH "AUTHORS"
357 +.nf
358 +Zac Medico <zmedico@g.o>
359 +.fi
360 +.SH "FILES"
361 +.TP
362 +.B /etc/make.conf
363 +Contains variables.
364 +.SH "SEE ALSO"
365 +.BR emerge (1),
366 +.BR make.conf (5),
367 +.BR portage (5)
368
369 Modified: main/branches/prefix/man/emerge.1
370 ===================================================================
371 --- main/branches/prefix/man/emerge.1 2009-04-02 13:02:59 UTC (rev 13277)
372 +++ main/branches/prefix/man/emerge.1 2009-04-02 13:06:41 UTC (rev 13278)
373 @@ -414,13 +414,6 @@
374 Results may vary, but the general outcome is a reduced or condensed
375 output from portage's displays.
376 .TP
377 -.BR "\-\-rdeps\-only"
378 -Discard all build\-time dependencies. This option is commonly used together
379 -with \fBROOT\fR and it should not be enabled under normal circumstances. For
380 -currently supported \fBEAPI\fR values, the dependencies specified in the
381 -\fBDEPEND\fR variable are discarded. However, behavior may change for new
382 -\fBEAPI\fRs when related extensions are added in the future.
383 -.TP
384 .BR "\-\-reinstall changed\-use"
385 Tells emerge to include installed packages where USE flags have
386 changed since installation. Unlike \fB\-\-newuse\fR, this option does
387 @@ -430,11 +423,15 @@
388 .BR \-\-root=DIR
389 Set the \fBROOT\fR environment variable.
390 .TP
391 -.BR "\-\-root\-deps"
392 -Install build\-time dependencies to \fBROOT\fR instead of /. This option
393 -should not be enabled under normal circumstances. For currently supported
394 -\fBEAPI\fR values, the dependencies specified in the \fBDEPEND\fR variable
395 -are used. However, behavior may change for new
396 +.BR "\-\-root\-deps[=rdeps]"
397 +If no argument is given then build\-time dependencies of packages for
398 +\fBROOT\fR are installed to
399 +\fBROOT\fR instead of /. If the \fBrdeps\fR argument is given then discard
400 +all build\-time dependencies of packages for \fBROOT\fR. This option is
401 +only meaningful when used together with \fBROOT\fR and it should not
402 +be enabled under normal circumstances. For currently supported
403 +\fBEAPI\fR values, the build-time dependencies are specified in the
404 +\fBDEPEND\fR variable. However, behavior may change for new
405 \fBEAPI\fRs when related extensions are added in the future.
406 .TP
407 .BR "\-\-skipfirst"
408
409 Modified: main/branches/prefix/pym/_emerge/__init__.py
410 ===================================================================
411 --- main/branches/prefix/pym/_emerge/__init__.py 2009-04-02 13:02:59 UTC (rev 13277)
412 +++ main/branches/prefix/pym/_emerge/__init__.py 2009-04-02 13:06:41 UTC (rev 13278)
413 @@ -222,7 +222,6 @@
414 "--nospinner", "--oneshot",
415 "--onlydeps", "--pretend",
416 "--quiet", "--resume",
417 -"--rdeps-only", "--root-deps",
418 "--searchdesc", "--selective",
419 "--skipfirst",
420 "--tree",
421 @@ -5303,12 +5302,12 @@
422 edepend["DEPEND"] = ""
423
424 bdeps_root = "/"
425 - if self.target_root != "/":
426 - if "--root-deps" in self.myopts:
427 - bdeps_root = myroot
428 - if "--rdeps-only" in self.myopts:
429 - bdeps_root = "/"
430 - edepend["DEPEND"] = ""
431 + root_deps = self.myopts.get("--root-deps")
432 + if root_deps is not None:
433 + if root_deps is True:
434 + bdeps_root = myroot
435 + elif root_deps == "rdeps":
436 + edepend["DEPEND"] = ""
437
438 deps = (
439 (bdeps_root, edepend["DEPEND"],
440 @@ -14854,11 +14853,22 @@
441
442 new_args = []
443 jobs_opts = ("-j", "--jobs")
444 + root_deps_opt = '--root-deps'
445 + root_deps_choices = ('True', 'rdeps')
446 arg_stack = args[:]
447 arg_stack.reverse()
448 while arg_stack:
449 arg = arg_stack.pop()
450
451 + if arg == root_deps_opt:
452 + new_args.append(arg)
453 + if arg_stack and arg_stack[-1] in root_deps_choices:
454 + new_args.append(arg_stack.pop())
455 + else:
456 + # insert default argument
457 + new_args.append('True')
458 + continue
459 +
460 short_job_opt = bool("j" in arg and arg[:1] == "-" and arg[:2] != "--")
461 if not (short_job_opt or arg in jobs_opts):
462 new_args.append(arg)
463 @@ -14951,6 +14961,12 @@
464 "help" : "specify the target root filesystem for merging packages",
465 "action" : "store"
466 },
467 +
468 + "--root-deps": {
469 + "help" : "modify interpretation of depedencies",
470 + "type" : "choice",
471 + "choices" :("True", "rdeps")
472 + },
473 }
474
475 from optparse import OptionParser
476 @@ -14979,6 +14995,9 @@
477
478 myoptions, myargs = parser.parse_args(args=tmpcmdline)
479
480 + if myoptions.root_deps == "True":
481 + myoptions.root_deps = True
482 +
483 if myoptions.jobs:
484 jobs = None
485 if myoptions.jobs == "True":
486
487 Modified: main/branches/prefix/pym/_emerge/help.py
488 ===================================================================
489 --- main/branches/prefix/pym/_emerge/help.py 2009-04-02 13:02:59 UTC (rev 13277)
490 +++ main/branches/prefix/pym/_emerge/help.py 2009-04-02 13:06:41 UTC (rev 13278)
491 @@ -410,15 +410,6 @@
492 print " Effects vary, but the general outcome is a reduced or condensed"
493 print " output from portage's displays."
494 print
495 - print " "+green("--rdeps-only")
496 - desc = "Discard all build-time dependencies. This option is commonly used together " + \
497 - "with ROOT and it should not be enabled under normal circumstances. For " + \
498 - "currently supported EAPI values, the dependencies specified in the " + \
499 - "DEPEND variable are discarded. However, behavior may change for new " + \
500 - "EAPIs when related extensions are added in the future."
501 - for line in wrap(desc, desc_width):
502 - print desc_indent + line
503 - print
504 print " "+green("--reinstall ") + turquoise("changed-use")
505 print " Tells emerge to include installed packages where USE flags have"
506 print " changed since installation. Unlike --newuse, this option does"
507 @@ -431,11 +422,15 @@
508 for line in wrap(desc, desc_width):
509 print desc_indent + line
510 print
511 - print " "+green("--root-deps")
512 - desc = "Install build-time dependencies to ROOT instead of /. This option " + \
513 - "should not be enabled under normal circumstances. For currently supported " + \
514 - "EAPI values, the dependencies specified in the DEPEND variable " + \
515 - "are used. However, behavior may change for new " + \
516 + print " "+green("--root-deps[=rdeps]")
517 + desc = "If no argument is given then build-time dependencies of packages for " + \
518 + "ROOT are installed to " + \
519 + "ROOT instead of /. If the rdeps argument is given then discard " + \
520 + "all build-time dependencies of packages for ROOT. This option is " + \
521 + "only meaningful when used together with ROOT and it should not " + \
522 + "be enabled under normal circumstances. For currently supported " + \
523 + "EAPI values, the build-time dependencies are specified in the " + \
524 + "DEPEND variable. However, behavior may change for new " + \
525 "EAPIs when related extensions are added in the future."
526 for line in wrap(desc, desc_width):
527 print desc_indent + line
528
529 Modified: main/branches/prefix/pym/portage/__init__.py
530 ===================================================================
531 --- main/branches/prefix/pym/portage/__init__.py 2009-04-02 13:02:59 UTC (rev 13277)
532 +++ main/branches/prefix/pym/portage/__init__.py 2009-04-02 13:06:41 UTC (rev 13278)
533 @@ -1098,7 +1098,7 @@
534 _environ_filter += [
535 "ACCEPT_KEYWORDS", "AUTOCLEAN",
536 "CLEAN_DELAY", "COLLISION_IGNORE", "CONFIG_PROTECT",
537 - "CONFIG_PROTECT_MASK", "EMERGE_DEFAULT_OPTS",
538 + "CONFIG_PROTECT_MASK", "EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS",
539 "EMERGE_WARNING_DELAY", "FETCHCOMMAND", "FETCHCOMMAND_FTP",
540 "FETCHCOMMAND_HTTP", "FETCHCOMMAND_SFTP",
541 "GENTOO_MIRRORS", "NOCONFMEM", "O",