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 / +14 lines)
Lines 144-152 def ParseArgs(argv, qahelp): Link Here
144
		'scan' : 'Scan directory tree for QA issues'
144
		'scan' : 'Scan directory tree for QA issues'
145
	}
145
	}
146
146
147
	output_choices = {
148
		'default' : 'The normal output format',
149
		'column' : 'Columnar output suitable for use with grep'
150
	}
151
147
	mode_keys = list(modes)
152
	mode_keys = list(modes)
148
	mode_keys.sort()
153
	mode_keys.sort()
149
154
155
	output_keys = sorted(output_choices)
156
150
	parser = ArgumentParser(usage="repoman [options] [mode]",
157
	parser = ArgumentParser(usage="repoman [options] [mode]",
151
		description="Modes: %s" % " | ".join(mode_keys),
158
		description="Modes: %s" % " | ".join(mode_keys),
152
		epilog="For more help consult the man page.")
159
		epilog="For more help consult the man page.")
Lines 228-233 def ParseArgs(argv, qahelp): Link Here
228
	parser.add_argument('--without-mask', dest='without_mask', action='store_true',
235
	parser.add_argument('--without-mask', dest='without_mask', action='store_true',
229
		default=False, help='behave as if no package.mask entries exist (not allowed with commit mode)')
236
		default=False, help='behave as if no package.mask entries exist (not allowed with commit mode)')
230
237
238
	parser.add_argument('--output-style', dest='output_style', choices=output_keys,
239
		help='select output type', default='default')
240
231
	parser.add_argument('--mode', dest='mode', choices=mode_keys,
241
	parser.add_argument('--mode', dest='mode', choices=mode_keys,
232
		help='specify which mode repoman will run in (default=full)')
242
		help='specify which mode repoman will run in (default=full)')
233
243
Lines 2422-2428 console_writer.style_listener = style_file.new_styles Link Here
2422
2432
2423
f = formatter.AbstractFormatter(console_writer)
2433
f = formatter.AbstractFormatter(console_writer)
2424
2434
2425
utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings)
2435
if options.output_style == 'column':
2436
	utilities.format_qa_output_column(f, stats, fails, dofull, dofail, options, qawarnings)
2437
else:
2438
	utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings)
2426
2439
2427
style_file.flush()
2440
style_file.flush()
2428
del console_writer, f, style_file
2441
del console_writer, f, style_file
(-)a/pym/repoman/utilities.py (+44 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_column(formatter, stats, fails, dofull, dofail, options, qawarnings):
334
	"""Helper function that formats output in a machine-parseable column format
335
336
	@param formatter: an instance of Formatter
337
	@type formatter: Formatter
338
	@param path: dict of qa status items
339
	@type path: dict
340
	@param fails: dict of qa status failures
341
	@type fails: dict
342
	@param dofull: Whether to print full results or a summary
343
	@type dofull: boolean
344
	@param dofail: Whether failure was hard or soft
345
	@type dofail: boolean
346
	@param options: The command-line options provided to repoman
347
	@type options: Namespace
348
	@param qawarnings: the set of warning types
349
	@type qawarnings: set
350
	@return: None (modifies formatter)
351
	"""
352
	full = options.mode == 'full'
353
	for category, number in stats.items():
354
		# we only want key value pairs where value > 0
355
		if number < 1:
356
			continue
357
358
		formatter.add_literal_data("NumberOf " + category + " ")
359
		if category in qawarnings:
360
			formatter.push_style("WARN")
361
		else:
362
			formatter.push_style("BAD")
363
		formatter.add_literal_data("%s" % number)
364
		formatter.pop_style()
365
		formatter.add_line_break()
366
		if not dofull:
367
			if not full and dofail and category in qawarnings:
368
				# warnings are considered noise when there are failures
369
				continue
370
			fails_list = fails[category]
371
			if not full and len(fails_list) > 12:
372
				fails_list = fails_list[:12]
373
			for failure in fails_list:
374
				formatter.add_literal_data(category + " " + failure)
375
				formatter.add_line_break()
376
333
def editor_is_executable(editor):
377
def editor_is_executable(editor):
334
	"""
378
	"""
335
	Given an EDITOR string, validate that it refers to
379
	Given an EDITOR string, validate that it refers to

Return to bug 481584