Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 481584 | Differences between
and this patch

Collapse All | Expand All

(-)a/bin/repoman (-1 / +7 lines)
Lines 231-236 def ParseArgs(argv, qahelp): Link Here
231
	parser.add_argument('--mode', dest='mode', choices=mode_keys,
231
	parser.add_argument('--mode', dest='mode', choices=mode_keys,
232
		help='specify which mode repoman will run in (default=full)')
232
		help='specify which mode repoman will run in (default=full)')
233
233
234
	parser.add_argument('--machine-parseable', dest='machine_parseable', action='store_true',
235
		default=False, help='output in a machine-parseable columnar format')
236
234
	opts, args = parser.parse_known_args(argv[1:])
237
	opts, args = parser.parse_known_args(argv[1:])
235
238
236
	if not opts.ignore_default_opts:
239
	if not opts.ignore_default_opts:
Lines 2422-2428 console_writer.style_listener = style_file.new_styles Link Here
2422
2425
2423
f = formatter.AbstractFormatter(console_writer)
2426
f = formatter.AbstractFormatter(console_writer)
2424
2427
2425
utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings)
2428
if options.machine_parseable:
2429
	utilities.format_qa_output_machine_parseable(f, stats, fails, dofull, dofail, options, qawarnings)
2430
else:
2431
	utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings)
2426
2432
2427
style_file.flush()
2433
style_file.flush()
2428
del console_writer, f, style_file
2434
del console_writer, f, style_file
(-)a/pym/repoman/utilities.py (+37 lines)
Lines 330-335 def format_qa_output(formatter, stats, fails, dofull, dofail, options, qawarning Link Here
330
				formatter.add_line_break()
330
				formatter.add_line_break()
331
331
332
332
333
def format_qa_output_machine_parseable(formatter, stats, fails, dofull, dofail, options, qawarnings):
334
	"""Helper function that formats output in a machine-parseable column format
335
336
	Args:
337
		formatter - a subclass of Formatter
338
		stats - a dict of qa status items
339
		fails - a dict of qa status failures
340
		dofull - boolean to print full results or a summary
341
		dofail - boolean to decide if failure was hard or soft
342
343
	Returns:
344
		None (modifies formatter)
345
	"""
346
	full = options.mode == 'full'
347
	# we only want key value pairs where value > 0 
348
	for category, number in \
349
		filter(lambda myitem: myitem[1] > 0, iter(stats.items())):
350
351
		formatter.add_literal_data("NumberOf " + category + " ")
352
		if category in qawarnings:
353
			formatter.push_style("WARN")
354
		else:   
355
			formatter.push_style("BAD")
356
		formatter.add_literal_data("%s" % number)
357
		formatter.pop_style()
358
		formatter.add_line_break()
359
		if not dofull:
360
			if not full and dofail and category in qawarnings:
361
				# warnings are considered noise when there are failures
362
				continue
363
			fails_list = fails[category]
364
			if not full and len(fails_list) > 12:
365
				fails_list = fails_list[:12]
366
			for failure in fails_list:
367
				formatter.add_literal_data(category + " " + failure)
368
				formatter.add_line_break()
369
333
def editor_is_executable(editor):
370
def editor_is_executable(editor):
334
	"""
371
	"""
335
	Given an EDITOR string, validate that it refers to
372
	Given an EDITOR string, validate that it refers to

Return to bug 481584