Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Joshua Lock <joshua.g.lock@linux.intel.com>
To: Paul Eggleton <paul.eggleton@linux.intel.com>,
	 bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 02/15] knotty: make quiet option a level option
Date: Tue, 13 Dec 2016 09:21:35 +0000	[thread overview]
Message-ID: <1481620895.3593.1.camel@linux.intel.com> (raw)
In-Reply-To: <e999fc0611f5e048953ade03cd2522b4d9d6c830.1481611138.git.paul.eggleton@linux.intel.com>

On Tue, 2016-12-13 at 20:07 +1300, Paul Eggleton wrote:
> Allow you to specify -q / --quiet more than once to reduce the
> messages
> even further. It will now operate as follows:
> 
>  Level  Option  Result
>  -----  ------  ----------------------------------------
>  0              Print usual output
>  1      -q      Only show progress and warnings or above
>  2      -qq     Only show warnings or above
>  3+     -qqq    Only show errors

I like this change, can we document the levels somewhere other than the
commit message?

Thanks,

Joshua

> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
>  lib/bb/main.py      |  4 ++--
>  lib/bb/ui/knotty.py | 35 ++++++++++++++++++++++++++++-------
>  2 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/bb/main.py b/lib/bb/main.py
> index f2f59f6..a544c0a 100755
> --- a/lib/bb/main.py
> +++ b/lib/bb/main.py
> @@ -179,8 +179,8 @@ class
> BitBakeConfigParameters(cookerdata.ConfigParameters):
>          parser.add_option("-D", "--debug", action="count",
> dest="debug", default=0,
>                            help="Increase the debug level. You can
> specify this more than once.")
>  
> -        parser.add_option("-q", "--quiet", action="store_true",
> dest="quiet", default=False,
> -                          help="Output less log message data to the
> terminal.")
> +        parser.add_option("-q", "--quiet", action="count",
> dest="quiet", default=0,
> +                          help="Output less log message data to the
> terminal. You can specify this more than once.")
>  
>          parser.add_option("-n", "--dry-run", action="store_true",
> dest="dry_run", default=False,
>                            help="Don't execute, just go through the
> motions.")
> diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
> index 48e1223..3390eb7 100644
> --- a/lib/bb/ui/knotty.py
> +++ b/lib/bb/ui/knotty.py
> @@ -284,7 +284,7 @@ class TerminalFilter(object):
>              content = self.main_progress.update(progress)
>              print('')
>          lines = 1 + int(len(content) / (self.columns + 1))
> -        if not self.quiet:
> +        if self.quiet == 0:
>              for tasknum, task in enumerate(tasks[:(self.rows - 2)]):
>                  if isinstance(task, tuple):
>                      pbar, progress, rate, start_time = task
> @@ -353,10 +353,13 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
>      errconsole = logging.StreamHandler(sys.stderr)
>      format_str = "%(levelname)s: %(message)s"
>      format = bb.msg.BBLogFormatter(format_str)
> -    if params.options.quiet:
> -        bb.msg.addDefaultlogFilter(console,
> bb.msg.BBLogFilterStdOut, bb.msg.BBLogFormatter.WARNING)
> +    if params.options.quiet == 0:
> +        forcelevel = None
> +    elif params.options.quiet > 2:
> +        forcelevel = bb.msg.BBLogFormatter.ERROR
>      else:
> -        bb.msg.addDefaultlogFilter(console,
> bb.msg.BBLogFilterStdOut)
> +        forcelevel = bb.msg.BBLogFormatter.WARNING
> +    bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut,
> forcelevel)
>      bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr)
>      console.setFormatter(format)
>      errconsole.setFormatter(format)
> @@ -506,35 +509,47 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
>                  logger.info(event._message)
>                  continue
>              if isinstance(event, bb.event.ParseStarted):
> +                if params.options.quiet > 1:
> +                    continue
>                  if event.total == 0:
>                      continue
>                  parseprogress = new_progress("Parsing recipes",
> event.total).start()
>                  continue
>              if isinstance(event, bb.event.ParseProgress):
> +                if params.options.quiet > 1:
> +                    continue
>                  if parseprogress:
>                      parseprogress.update(event.current)
>                  else:
>                      bb.warn("Got ParseProgress event for parsing
> that never started?")
>                  continue
>              if isinstance(event, bb.event.ParseCompleted):
> +                if params.options.quiet > 1:
> +                    continue
>                  if not parseprogress:
>                      continue
>                  parseprogress.finish()
>                  pasreprogress = None
> -                if not params.options.quiet:
> +                if params.options.quiet == 0:
>                      print(("Parsing of %d .bb files complete (%d
> cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
>                          % ( event.total, event.cached, event.parsed,
> event.virtuals, event.skipped, event.masked, event.errors)))
>                  continue
>  
>              if isinstance(event, bb.event.CacheLoadStarted):
> +                if params.options.quiet > 1:
> +                    continue
>                  cacheprogress = new_progress("Loading cache",
> event.total).start()
>                  continue
>              if isinstance(event, bb.event.CacheLoadProgress):
> +                if params.options.quiet > 1:
> +                    continue
>                  cacheprogress.update(event.current)
>                  continue
>              if isinstance(event, bb.event.CacheLoadCompleted):
> +                if params.options.quiet > 1:
> +                    continue
>                  cacheprogress.finish()
> -                if not params.options.quiet:
> +                if params.options.quiet == 0:
>                      print("Loaded %d entries from dependency cache."
> % event.num_entries)
>                  continue
>  
> @@ -620,16 +635,22 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
>                  continue
>  
>              if isinstance(event, bb.event.ProcessStarted):
> +                if params.options.quiet > 1:
> +                    continue
>                  parseprogress = new_progress(event.processname,
> event.total)
>                  parseprogress.start(False)
>                  continue
>              if isinstance(event, bb.event.ProcessProgress):
> +                if params.options.quiet > 1:
> +                    continue
>                  if parseprogress:
>                      parseprogress.update(event.progress)
>                  else:
>                      bb.warn("Got ProcessProgress event for someting
> that never started?")
>                  continue
>              if isinstance(event, bb.event.ProcessFinished):
> +                if params.options.quiet > 1:
> +                    continue
>                  if parseprogress:
>                      parseprogress.finish()
>                  parseprogress = None
> @@ -701,7 +722,7 @@ def main(server, eventHandler, params, tf =
> TerminalFilter):
>          if return_value and errors:
>              summary += pluralise("\nSummary: There was %s ERROR
> message shown, returning a non-zero exit code.",
>                                   "\nSummary: There were %s ERROR
> messages shown, returning a non-zero exit code.", errors)
> -        if summary and not params.options.quiet:
> +        if summary and params.options.quiet == 0:
>              print(summary)
>  
>          if interrupted:
> -- 
> 2.5.5
> 


  reply	other threads:[~2016-12-13  9:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  7:06 [PATCH 00/15] Tinfoil rework Paul Eggleton
2016-12-13  7:07 ` [PATCH 01/15] data_smart: fix resetting of reference on variablehistory Paul Eggleton
2016-12-13  7:07 ` [PATCH 02/15] knotty: make quiet option a level option Paul Eggleton
2016-12-13  9:21   ` Joshua Lock [this message]
2016-12-13  7:07 ` [PATCH 03/15] knotty: fix --observe-only option Paul Eggleton
2016-12-13  7:07 ` [PATCH 04/15] server/xmlrpc: send back 503 response with correct encoding Paul Eggleton
2016-12-13  7:07 ` [PATCH 05/15] data_smart: implement remote datastore functionality Paul Eggleton
2016-12-13  7:07 ` [PATCH 06/15] command: provide a means to shut down from the client in memres mode Paul Eggleton
2016-12-13  7:07 ` [PATCH 07/15] tinfoil: rewrite as a wrapper around the UI Paul Eggleton
2016-12-13  7:07 ` [PATCH 08/15] remotedata: enable transporting datastore from the client to the server Paul Eggleton
2016-12-13  7:07 ` [PATCH 09/15] tinfoil: implement server-side recipe parsing Paul Eggleton
2016-12-13  7:07 ` [PATCH 10/15] tinfoil: pass datastore to server when expanding python references Paul Eggleton
2016-12-13  7:07 ` [PATCH 11/15] cooker: allow buildFile warning to be hidden programmatically Paul Eggleton
2016-12-13  7:07 ` [PATCH 12/15] data_smart: support serialisation Paul Eggleton
2016-12-13  7:07 ` [PATCH 13/15] runqueue: enable setVariable command to affect task execution Paul Eggleton
2016-12-13  7:07 ` [PATCH 14/15] siggen: add means of ignoring basehash mismatch Paul Eggleton
2016-12-13  7:07 ` [PATCH 15/15] server/process: don't change UI process signal handler on terminate Paul Eggleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481620895.3593.1.camel@linux.intel.com \
    --to=joshua.g.lock@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox