Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12130 - in main/branches/prefix: bin cnf doc/config man pym/_emerge pym/portage pym/portage/sets pym/repoman
Date: Mon, 01 Dec 2008 20:56:05
Message-Id: E1L7FoI-0006id-EK@stork.gentoo.org
1 Author: grobian
2 Date: 2008-12-01 20:56:01 +0000 (Mon, 01 Dec 2008)
3 New Revision: 12130
4
5 Modified:
6 main/branches/prefix/bin/emaint
7 main/branches/prefix/bin/etc-update
8 main/branches/prefix/bin/repoman
9 main/branches/prefix/cnf/sets.conf
10 main/branches/prefix/doc/config/sets.docbook
11 main/branches/prefix/man/ebuild.5
12 main/branches/prefix/man/emaint.1
13 main/branches/prefix/man/repoman.1
14 main/branches/prefix/pym/_emerge/__init__.py
15 main/branches/prefix/pym/portage/__init__.py
16 main/branches/prefix/pym/portage/sets/dbapi.py
17 main/branches/prefix/pym/repoman/utilities.py
18 Log:
19 Merged from trunk -r12040:12057
20
21 | 12041 | Add some hints about bash binary corruption and hardware |
22 | zmedico | malfunction to the message that's displayed when bash exits |
23 | | unexpectedly. |
24
25 | 12043 | Add new @unavailable package set which contains all |
26 | zmedico | installed packages for which there are no visible ebuilds |
27 | | corresponding to the same $CATEGORY/$PN:$SLOT. |
28
29 | 12044 | Add back accidentally removed @downgrade set. Thanks to |
30 | zmedico | Arfrever. |
31
32 | 12045 | When displaying anscestors of an unstatisfied dependency |
33 | zmedico | (code from bug #245358), avoid a potential infinite loop and |
34 | | memory leak triggered by circular dependencies. Thanks to |
35 | | Peter Weller <welp@g.o> for reporting. |
36
37 | 12047 | Add docs for all of the supported commands. |
38 | zmedico | |
39
40 | 12049 | Bug #247548 - Remove 'last' and 'lfull' commands since |
41 | zmedico | nobody uses them. Thanks to Alec Warner <antarus@g.o>. |
42
43 | 12051 | Fix the code from bug #245358 so that it's guaranteed to |
44 | zmedico | traverse all the way to a root node, even when circular deps |
45 | | are encountered. |
46
47 | 12053 | Bug #188780 - Make the read_int() function show a more human |
48 | zmedico | readable error message, instead of the 'value too great for |
49 | | base' message when the user enters an invalid value such as |
50 | | '1y'. |
51
52 | 12055 | Fix SIGINT and SIGTERM trap handling so the temp dir always |
53 | zmedico | cleaned up when killed. |
54
55 | 12057 | Add a note about negative IUSE default settings being |
56 | zmedico | ineffective given the default USE_ORDER setting which causes |
57 | | profile and user configuration settings to override them. |
58
59
60 Modified: main/branches/prefix/bin/emaint
61 ===================================================================
62 --- main/branches/prefix/bin/emaint 2008-12-01 19:06:29 UTC (rev 12129)
63 +++ main/branches/prefix/bin/emaint 2008-12-01 20:56:01 UTC (rev 12130)
64 @@ -4,6 +4,7 @@
65 import re
66 import signal
67 import sys
68 +import textwrap
69 import time
70 from optparse import OptionParser, OptionValueError
71
72 @@ -20,6 +21,8 @@
73
74 class WorldHandler(object):
75
76 + short_desc = "Fix problems in the world file"
77 +
78 def name():
79 return "world"
80 name = staticmethod(name)
81 @@ -105,6 +108,8 @@
82
83 class BinhostHandler(object):
84
85 + short_desc = "Generate a metadata index for binary packages"
86 +
87 def name():
88 return "binhost"
89 name = staticmethod(name)
90 @@ -317,6 +322,9 @@
91 return errors
92
93 class MoveInstalled(MoveHandler):
94 +
95 + short_desc = "Perform package move updates for installed packages"
96 +
97 def name():
98 return "moveinst"
99 name = staticmethod(name)
100 @@ -325,6 +333,9 @@
101 MoveHandler.__init__(self, portage.db[myroot]["vartree"])
102
103 class MoveBinary(MoveHandler):
104 +
105 + short_desc = "Perform package move updates for binary packages"
106 +
107 def name():
108 return "movebin"
109 name = staticmethod(name)
110 @@ -409,6 +420,9 @@
111 raise NotImplementedError(self)
112
113 class CleanResume(object):
114 +
115 + short_desc = "Discard emerge --resume merge lists"
116 +
117 def name():
118 return "cleanresume"
119 name = staticmethod(name)
120 @@ -485,12 +499,20 @@
121 setattr(parser, var, str(option))
122
123
124 - usage = "usage: emaint [options] " + " | ".join(module_names)
125 + usage = "usage: emaint [options] COMMAND"
126
127 - usage+= "\n\nCurrently emaint can only check and fix problems with one's world\n"
128 - usage+= "file. Future versions will integrate other portage check-and-fix\n"
129 - usage+= "tools and provide a single interface to system health checks."
130 + desc = "The emaint program provides an interface to system health " + \
131 + "checks and maintenance. See the emaint(1) man page for " + \
132 + "for additional information about the following commands:"
133
134 + usage += "\n\n"
135 + for line in textwrap.wrap(desc, 65):
136 + usage += "%s\n" % line
137 + usage += "\n"
138 + usage += " %s" % "all".ljust(15) + \
139 + "Perform all supported commands\n"
140 + for m in module_names[1:]:
141 + usage += " %s%s\n" % (m.ljust(15), modules[m].short_desc)
142
143 parser = OptionParser(usage=usage, version=portage.VERSION)
144 parser.add_option("-c", "--check", help="check for problems",
145
146 Modified: main/branches/prefix/bin/etc-update
147 ===================================================================
148 --- main/branches/prefix/bin/etc-update 2008-12-01 19:06:29 UTC (rev 12129)
149 +++ main/branches/prefix/bin/etc-update 2008-12-01 20:56:01 UTC (rev 12130)
150 @@ -223,7 +223,8 @@
151 read my_input
152 # failed integer conversions will break a loop unless they're enclosed
153 # in a subshell.
154 - echo "${my_input}" | ( declare -i x; read x) && break
155 + echo "${my_input}" | ( declare -i x; read x) 2>/dev/null && break
156 + echo -n "Value '$my_input' is not valid. Please enter an integer value:" >&2
157 done
158 echo ${my_input}
159 }
160 @@ -445,10 +446,9 @@
161 }
162
163 die() {
164 - trap "" TERM
165 - trap "" KILL
166 + trap SIGTERM SIGINT
167
168 - if [ ${2} -eq 0 ]; then
169 + if [ "$2" -eq 0 ]; then
170 echo "Exiting: ${1}"
171 scan > /dev/null
172 [ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
173 @@ -500,7 +500,8 @@
174 export EROOT=${ROOT%/}${EPREFIX}/
175
176 TMP="${PORTAGE_TMPDIR}/etc-update-$$"
177 -trap die term
178 +trap "die terminated 1" SIGTERM
179 +trap "die interrupted 1" SIGINT
180
181 [ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_CONFIGROOT}etc" 1
182 #echo $PORTAGE_TMPDIR
183
184 Modified: main/branches/prefix/bin/repoman
185 ===================================================================
186 --- main/branches/prefix/bin/repoman 2008-12-01 19:06:29 UTC (rev 12129)
187 +++ main/branches/prefix/bin/repoman 2008-12-01 20:56:01 UTC (rev 12130)
188 @@ -26,11 +26,6 @@
189 from stat import S_ISDIR, ST_CTIME
190
191 try:
192 - import cPickle as pickle
193 -except ImportError:
194 - import pickle
195 -
196 -try:
197 import cStringIO as StringIO
198 except ImportError:
199 import StringIO
200 @@ -149,8 +144,6 @@
201 'fix' : 'Fix simple QA issues (stray digests, missing digests)',
202 'full' : 'Scan directory tree and print all issues (not a summary)',
203 'help' : 'Show this screen',
204 - 'last' : 'Remember report from last run',
205 - 'lfull' : 'Remember report from last run (full listing)',
206 'manifest' : 'Generate a Manifest (fetches files if necessary)',
207 'scan' : 'Scan directory tree for QA issues'
208 }
209 @@ -226,7 +219,7 @@
210 break
211
212 if not opts.mode:
213 - opts.mode = 'full' #default to full
214 + opts.mode = 'full'
215
216 if opts.mode == 'ci':
217 opts.mode = 'commit' # backwards compat shortcut
218 @@ -424,61 +417,8 @@
219 # file.executable
220 no_exec = frozenset(["Manifest","ChangeLog","metadata.xml"])
221
222 -def last(full=False):
223 - """Print the results of the last repoman run
224 - Args:
225 - full - Print the complete results, if false, print a summary
226 - Returns:
227 - Doesn't return (invokes sys.exit()
228 - """
229 - #Retrieve and unpickle stats and fails from saved files
230 - savedf=open(os.path.join(portage.const.CACHE_PATH, 'repo.stats'),'r')
231 - stats = pickle.load(savedf)
232 - savedf.close()
233 - savedf=open(os.path.join(portage.const.CACHE_PATH, 'repo.fails'),'r')
234 - fails = pickle.load(savedf)
235 - savedf.close()
236 -
237 - #dofail will be set to 1 if we have failed in at least one non-warning category
238 - dofail=0
239 - #dowarn will be set to 1 if we tripped any warnings
240 - dowarn=0
241 - #dofull will be set if we should print a "repoman full" informational message
242 - dofull=0
243 -
244 - dofull = options.mode not in ("full", "lfull")
245 -
246 - for x in qacats:
247 - if not stats[x]:
248 - continue
249 - dowarn = 1
250 - if x not in qawarnings:
251 - dofail = 1
252 -
253 - print
254 - print green("RepoMan remembers...")
255 - print
256 - style_file = ConsoleStyleFile(sys.stdout)
257 - console_writer = StyleWriter(file=style_file, maxcol=9999)
258 - console_writer.style_listener = style_file.new_styles
259 - f = formatter.AbstractFormatter(console_writer)
260 - utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings)
261 - print
262 - if dofull:
263 - print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.")
264 - print
265 - if dowarn and not dofail:
266 - print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\n I took it, but I wasn't happy.\""
267 - elif not dofail:
268 - print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\""
269 - print
270 - sys.exit(0)
271 -
272 options, arguments = ParseArgs(sys.argv, qahelp)
273
274 -if options.mode in ('last', 'lfull'):
275 - last('lfull' in options.mode)
276 -
277 # Set this to False when an extraordinary issue (generally
278 # something other than a QA issue) makes it impossible to
279 # commit (like if Manifest generation fails).
280 @@ -1608,24 +1548,12 @@
281 if options.mode == "manifest":
282 sys.exit(dofail)
283
284 -#Pickle and save results for instant reuse in last and lfull
285 -if os.access(portage.const.CACHE_PATH, os.W_OK):
286 - for myobj, fname in (stats, "repo.stats"), (fails, "repo.fails"):
287 - fpath = os.path.join(portage.const.CACHE_PATH, fname)
288 - savef = open(fpath, 'w')
289 - pickle.dump(myobj, savef)
290 - savef.close()
291 - portage.apply_secpass_permissions(fpath, gid=portage.portage_gid,
292 - mode=0664)
293 -
294 -# TODO(antarus) This function and last () look familiar ;)
295 -
296 #dofail will be set to 1 if we have failed in at least one non-warning category
297 dofail=0
298 #dowarn will be set to 1 if we tripped any warnings
299 dowarn=0
300 #dofull will be set if we should print a "repoman full" informational message
301 -dofull = options.mode not in ("full", "lfull")
302 +dofull = options.mode != 'full'
303
304 for x in qacats:
305 if not stats[x]:
306
307 Modified: main/branches/prefix/cnf/sets.conf
308 ===================================================================
309 --- main/branches/prefix/cnf/sets.conf 2008-12-01 19:06:29 UTC (rev 12129)
310 +++ main/branches/prefix/cnf/sets.conf 2008-12-01 20:56:01 UTC (rev 12130)
311 @@ -64,3 +64,9 @@
312 [downgrade]
313 class = portage.sets.dbapi.DowngradeSet
314 world-candidate = False
315 +
316 +# Installed packages for which there are no visible ebuilds
317 +# corresponding to the same $CATEGORY/$PN:$SLOT.
318 +[unavailable]
319 +class = portage.sets.dbapi.UnavailableSet
320 +world-candidate = False
321
322 Modified: main/branches/prefix/doc/config/sets.docbook
323 ===================================================================
324 --- main/branches/prefix/doc/config/sets.docbook 2008-12-01 19:06:29 UTC (rev 12129)
325 +++ main/branches/prefix/doc/config/sets.docbook 2008-12-01 20:56:01 UTC (rev 12130)
326 @@ -522,6 +522,20 @@
327 </itemizedlist>
328 </para>
329 </sect2>
330 + <sect2 id='config-set-classes-UnavailableSet'>
331 + <title>portage.sets.dbapi.UnavailableSet</title>
332 + <para>
333 + Package set which contains all installed
334 + packages for which there are no visible ebuilds
335 + corresponding to the same $CATEGORY/$PN:$SLOT.
336 + This class supports the following options:
337 + <itemizedlist>
338 + <listitem><varname>metadata-source</varname>: Optional, defaults to
339 + "porttree". Specifies the repository to use for getting the metadata
340 + to check.</listitem>
341 + </itemizedlist>
342 + </para>
343 + </sect2>
344 <sect2 id='config-set-classes-DowngradeSet'>
345 <title>portage.sets.dbapi.DowngradeSet</title>
346 <para>
347 @@ -571,6 +585,7 @@
348 <listitem><varname>live-rebuild</varname>: uses <classname>VariableSet</classname></listitem>
349 <listitem><varname>module-rebuild</varname>: uses <classname>OwnerSet</classname></listitem>
350 <listitem><varname>downgrade</varname>: uses <classname>DowngradeSet</classname></listitem>
351 + <listitem><varname>unavailable</varname>: uses <classname>UnavailableSet</classname></listitem>
352 </itemizedlist>
353 Additionally the default configuration includes a multi set section based on
354 the <classname>StaticFileSet</classname> defaults that creates a set for each
355
356 Modified: main/branches/prefix/man/ebuild.5
357 ===================================================================
358 --- main/branches/prefix/man/ebuild.5 2008-12-01 19:06:29 UTC (rev 12129)
359 +++ main/branches/prefix/man/ebuild.5 2008-12-01 20:56:01 UTC (rev 12130)
360 @@ -196,7 +196,9 @@
361 is possible to prefix flags with + or - in order to create default settings
362 that respectively enable or disable the corresponding \fBUSE\fR flags. For
363 details about \fBUSE\fR flag stacking order, refer to the \fBUSE_ORDER\fR
364 -variable in \fBmake.conf\fR(5).
365 +variable in \fBmake.conf\fR(5). Given the default \fBUSE_ORDER\fR setting,
366 +negative IUSE default settings are ineffective since profile and user
367 +configuration settings override them.
368 .TP
369 \fBDEPEND\fR
370 This should contain a list of all packages that are required for the
371
372 Modified: main/branches/prefix/man/emaint.1
373 ===================================================================
374 --- main/branches/prefix/man/emaint.1 2008-12-01 19:06:29 UTC (rev 12129)
375 +++ main/branches/prefix/man/emaint.1 2008-12-01 20:56:01 UTC (rev 12130)
376 @@ -4,10 +4,32 @@
377 .SH SYNOPSIS
378 .BR emaint
379 [\fIoptions\fR]
380 -[\fBall\fR | \fBworld\fR]
381 +[\fBall\fR | \fBbinhost\fR | \fBcleanresume\fR | \
382 +\fBmovebin\fR | \fBmoveinst\fR | \fBworld\fR]
383 .SH DESCRIPTION
384 -.B emaint
385 -checks for and fixes problems in the portage \fIworld\fR file.
386 +The emaint program provides an interface to system health
387 +checks and maintenance.
388 +.SH COMMANDS
389 +.TP
390 +.BR all
391 +Perform all supported commands.
392 +.TP
393 +.BR binhost
394 +Generate a metadata index for binary packages located in \fBPKGDIR\fR (for
395 +download by remote clients). See the \fBPORTAGE_BINHOST\fR documentation in
396 +the \fBmake.conf\fR(5) man page for additional information.
397 +.TP
398 +.BR cleanresume
399 +Discard merge lists saved for the \fBemerge\fR(1) \fB--resume\fR action.
400 +.TP
401 +.BR movebin
402 +Perform package move updates for binary packages located in \fBPKGDIR\fR.
403 +.TP
404 +.BR moveinst
405 +Perform package move updates for installed packages.
406 +.TP
407 +.BR world
408 +Fix problems in the \fIworld\fR file.
409 .SH OPTIONS
410 .TP
411 .B \-c, \-\-check
412
413 Modified: main/branches/prefix/man/repoman.1
414 ===================================================================
415 --- main/branches/prefix/man/repoman.1 2008-12-01 19:06:29 UTC (rev 12129)
416 +++ main/branches/prefix/man/repoman.1 2008-12-01 20:56:01 UTC (rev 12130)
417 @@ -59,9 +59,6 @@
418 .B full
419 Scan directory tree for QA issues (full listing)
420 .TP
421 -.B last
422 -Remember report from last run
423 -.TP
424 .B help
425 Show this screen
426 .TP
427 @@ -71,9 +68,6 @@
428 .B fix
429 Fix simple QA issues (stray digests, missing digests)
430 .TP
431 -.B lfull
432 -Remember report from last run (full listing)
433 -.TP
434 .B manifest
435 Generate a Manifest (fetches files if necessary)
436 .TP
437
438 Modified: main/branches/prefix/pym/_emerge/__init__.py
439 ===================================================================
440 --- main/branches/prefix/pym/_emerge/__init__.py 2008-12-01 19:06:29 UTC (rev 12129)
441 +++ main/branches/prefix/pym/_emerge/__init__.py 2008-12-01 20:56:01 UTC (rev 12130)
442 @@ -5435,19 +5435,26 @@
443 print "\nemerge: there are no ebuilds to satisfy "+green(xinfo)+"."
444
445 # Show parent nodes and the argument that pulled them in.
446 + traversed_nodes = set()
447 node = myparent
448 msg = []
449 while node is not None:
450 + traversed_nodes.add(node)
451 msg.append('(dependency required by "%s" [%s])' % \
452 (colorize('INFORM', str(node.cpv)), node.type_name))
453 - parent = None
454 + # When traversing to parents, prefer arguments over packages
455 + # since arguments are root nodes. Never traverse the same
456 + # package twice, in order to prevent an infinite loop.
457 + selected_parent = None
458 for parent in self.digraph.parent_nodes(node):
459 if isinstance(parent, DependencyArg):
460 msg.append('(dependency required by "%s" [argument])' % \
461 (colorize('INFORM', str(parent))))
462 - parent = None
463 + selected_parent = None
464 break
465 - node = parent
466 + if parent not in traversed_nodes:
467 + selected_parent = parent
468 + node = selected_parent
469 for line in msg:
470 print line
471
472
473 Modified: main/branches/prefix/pym/portage/__init__.py
474 ===================================================================
475 --- main/branches/prefix/pym/portage/__init__.py 2008-12-01 19:06:29 UTC (rev 12129)
476 +++ main/branches/prefix/pym/portage/__init__.py 2008-12-01 20:56:01 UTC (rev 12130)
477 @@ -5179,7 +5179,9 @@
478 "is known to be triggered " + \
479 "by things such as failed variable " + \
480 "assignments (bug #190128) or bad substitution " + \
481 - "errors (bug #200313)."
482 + "errors (bug #200313). This behavior may also be " + \
483 + "triggered by a corrupt bash binary or a hardware " + \
484 + "problem such as memory or cpu malfunction."
485 return msg
486
487 def _doebuild_exit_status_check_and_log(settings, mydo, retval):
488
489 Modified: main/branches/prefix/pym/portage/sets/dbapi.py
490 ===================================================================
491 --- main/branches/prefix/pym/portage/sets/dbapi.py 2008-12-01 19:06:29 UTC (rev 12129)
492 +++ main/branches/prefix/pym/portage/sets/dbapi.py 2008-12-01 20:56:01 UTC (rev 12130)
493 @@ -179,6 +179,33 @@
494
495 singleBuilder = classmethod(singleBuilder)
496
497 +class UnavailableSet(EverythingSet):
498 +
499 + _operations = ["unmerge"]
500 +
501 + description = "Package set which contains all installed " + \
502 + "packages for which there are no visible ebuilds " + \
503 + "corresponding to the same $CATEGORY/$PN:$SLOT."
504 +
505 + def __init__(self, vardb, metadatadb=None):
506 + super(UnavailableSet, self).__init__(vardb)
507 + self._metadatadb = metadatadb
508 +
509 + def _filter(self, atom):
510 + return not self._metadatadb.match(atom)
511 +
512 + def singleBuilder(cls, options, settings, trees):
513 +
514 + metadatadb = options.get("metadata-source", "porttree")
515 + if not metadatadb in trees:
516 + raise SetConfigError(("invalid value '%s' for option " + \
517 + "metadata-source") % (metadatadb,))
518 +
519 + return cls(trees["vartree"].dbapi,
520 + metadatadb=trees[metadatadb].dbapi)
521 +
522 + singleBuilder = classmethod(singleBuilder)
523 +
524 class CategorySet(PackageSet):
525 _operations = ["merge", "unmerge"]
526
527
528 Modified: main/branches/prefix/pym/repoman/utilities.py
529 ===================================================================
530 --- main/branches/prefix/pym/repoman/utilities.py 2008-12-01 19:06:29 UTC (rev 12129)
531 +++ main/branches/prefix/pym/repoman/utilities.py 2008-12-01 20:56:01 UTC (rev 12130)
532 @@ -211,7 +211,7 @@
533 Returns:
534 None (modifies formatter)
535 """
536 - full = options.mode in ("full", "lfull")
537 + full = options.mode == 'full'
538 # we only want key value pairs where value > 0
539 for category, number in \
540 itertools.ifilter(lambda myitem: myitem[1] > 0, stats.iteritems()):