Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 370090 Details for
Bug 481584
Repoman: Output is needlessly hard to parse
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
repoman-parseable.patch
repoman-parseable.patch (text/plain), 2.96 KB, created by
Chris Reffett (RETIRED)
on 2014-02-10 20:42:27 UTC
(
hide
)
Description:
repoman-parseable.patch
Filename:
MIME Type:
Creator:
Chris Reffett (RETIRED)
Created:
2014-02-10 20:42:27 UTC
Size:
2.96 KB
patch
obsolete
>commit 35f5ea565c6e06510ea59e077848c540ffe8789b >Author: Chris Reffett <creffett@gentoo.org> >Date: Mon Feb 10 15:16:33 2014 -0500 > > Add --machine-parseable option to repoman > > This patch adds --machine-parseable option to repoman, which outputs the > warnings in a more easily greppable format. Fixes bug 481584. > >diff --git a/bin/repoman b/bin/repoman >index 3504b6b..28feee6 100755 >--- a/bin/repoman >+++ b/bin/repoman >@@ -231,6 +231,9 @@ def ParseArgs(argv, qahelp): > parser.add_argument('--mode', dest='mode', choices=mode_keys, > help='specify which mode repoman will run in (default=full)') > >+ parser.add_argument('--machine-parseable', dest='machine_parseable', action='store_true', >+ default=False, help='output in a machine-parseable columnar format') >+ > opts, args = parser.parse_known_args(argv[1:]) > > if not opts.ignore_default_opts: >@@ -2422,7 +2425,10 @@ console_writer.style_listener = style_file.new_styles > > f = formatter.AbstractFormatter(console_writer) > >-utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings) >+if options.machine_parseable: >+ utilities.format_qa_output_machine_parseable(f, stats, fails, dofull, dofail, options, qawarnings) >+else: >+ utilities.format_qa_output(f, stats, fails, dofull, dofail, options, qawarnings) > > style_file.flush() > del console_writer, f, style_file >diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py >index 3ec3a4a..e230f0f 100644 >--- a/pym/repoman/utilities.py >+++ b/pym/repoman/utilities.py >@@ -330,6 +330,43 @@ def format_qa_output(formatter, stats, fails, dofull, dofail, options, qawarning > formatter.add_line_break() > > >+def format_qa_output_machine_parseable(formatter, stats, fails, dofull, dofail, options, qawarnings): >+ """Helper function that formats output in a machine-parseable column format >+ >+ Args: >+ formatter - a subclass of Formatter >+ stats - a dict of qa status items >+ fails - a dict of qa status failures >+ dofull - boolean to print full results or a summary >+ dofail - boolean to decide if failure was hard or soft >+ >+ Returns: >+ None (modifies formatter) >+ """ >+ full = options.mode == 'full' >+ # we only want key value pairs where value > 0 >+ for category, number in \ >+ filter(lambda myitem: myitem[1] > 0, iter(stats.items())): >+ >+ formatter.add_literal_data("NumberOf " + category + " ") >+ if category in qawarnings: >+ formatter.push_style("WARN") >+ else: >+ formatter.push_style("BAD") >+ formatter.add_literal_data("%s" % number) >+ formatter.pop_style() >+ formatter.add_line_break() >+ if not dofull: >+ if not full and dofail and category in qawarnings: >+ # warnings are considered noise when there are failures >+ continue >+ fails_list = fails[category] >+ if not full and len(fails_list) > 12: >+ fails_list = fails_list[:12] >+ for failure in fails_list: >+ formatter.add_literal_data(category + " " + failure) >+ formatter.add_line_break() >+ > def editor_is_executable(editor): > """ > Given an EDITOR string, validate that it refers to
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 481584
:
370090
|
370114