All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Minor improvements to error messages
@ 2012-01-11 18:30 Paul Eggleton
  2012-01-11 18:30 ` [PATCH 1/4] bitbake/knotty: don't count errors as warnings Paul Eggleton
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-01-11 18:30 UTC (permalink / raw)
  To: bitbake-devel

A few minor improvements to error output. I'm still working on some
deeper improvements but these are ready to go in immediately.

The patches (against Poky, but apply cleanly with -p2 against bitbake
master) are available in the git repository at:
  git://git.yoctoproject.org/poky-contrib paule/errorhandling1
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/errorhandling1

Paul Eggleton (4):
  bitbake/knotty: don't count errors as warnings
  bitbake: improve error formatting for fetcher errors
  bitbake: make warning for initial fetch failure one line
  bitbake/runqueue: avoid "failed" in task summary if nothing did

 bitbake/lib/bb/build.py           |    2 +-
 bitbake/lib/bb/fetch2/__init__.py |   10 +++++++---
 bitbake/lib/bb/runqueue.py        |    6 +++++-
 bitbake/lib/bb/ui/knotty.py       |    2 +-
 4 files changed, 14 insertions(+), 6 deletions(-)

-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] bitbake/knotty: don't count errors as warnings
  2012-01-11 18:30 [PATCH 0/4] Minor improvements to error messages Paul Eggleton
@ 2012-01-11 18:30 ` Paul Eggleton
  2012-01-11 18:30 ` [PATCH 2/4] bitbake: improve error formatting for fetcher errors Paul Eggleton
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-01-11 18:30 UTC (permalink / raw)
  To: bitbake-devel

The count of warnings being shown at the end also included the number
of errors.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/ui/knotty.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 0340619..cd6e0e7 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -127,7 +127,7 @@ def main(server, eventHandler):
                 if event.levelno >= format.ERROR:
                     errors = errors + 1
                     return_value = 1
-                if event.levelno >= format.WARNING:
+                elif event.levelno >= format.WARNING:
                     warnings = warnings + 1
                 # For "normal" logging conditions, don't show note logs from tasks
                 # but do show them if the user has changed the default log level to 
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] bitbake: improve error formatting for fetcher errors
  2012-01-11 18:30 [PATCH 0/4] Minor improvements to error messages Paul Eggleton
  2012-01-11 18:30 ` [PATCH 1/4] bitbake/knotty: don't count errors as warnings Paul Eggleton
@ 2012-01-11 18:30 ` Paul Eggleton
  2012-01-11 18:30 ` [PATCH 3/4] bitbake: make warning for initial fetch failure one line Paul Eggleton
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-01-11 18:30 UTC (permalink / raw)
  To: bitbake-devel

* The "name" argument to FuncFailed is rarely used as a name in actual
  usage within bitbake, so don't treat it as one in the output.
* Don't print URL for FetchError if it was not specified (i.e. don't
  output "Fetcher failure for URL 'None'")
* Don't include URL in "unable to fetch from any source" message since
  we supply it to FetchError and it will be printed anyway.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/build.py           |    2 +-
 bitbake/lib/bb/fetch2/__init__.py |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index aabc1b6..30e5497 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -53,7 +53,7 @@ class FuncFailed(Exception):
         self.logfile = logfile
         self.name = name
         if name:
-            self.msg = "Function '%s' failed" % name
+            self.msg = 'Function failed: %s' % name
         else:
             self.msg = "Function failed"
 
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 3af56e5..b76358d 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -55,7 +55,10 @@ class MalformedUrl(BBFetchException):
 class FetchError(BBFetchException):
     """General fetcher exception when something happens incorrectly"""
     def __init__(self, message, url = None):
-         msg = "Fetcher failure for URL: '%s'. %s" % (url, message)
+         if url:
+            msg = "Fetcher failure for URL: '%s'. %s" % (url, message)
+         else:
+            msg = "Fetcher failure: %s" % message
          self.url = url
          BBFetchException.__init__(self, msg)
          self.args = (message, url)
@@ -983,7 +986,7 @@ class Fetch(object):
                         localpath = try_mirrors (self.d, ud, mirrors)
 
                 if not localpath or ((not os.path.exists(localpath)) and localpath.find("*") == -1):
-                    raise FetchError("Unable to fetch URL %s from any source." % u, u)
+                    raise FetchError("Unable to fetch URL from any source.", u)
 
                 update_stamp(u, ud, self.d)
 
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] bitbake: make warning for initial fetch failure one line
  2012-01-11 18:30 [PATCH 0/4] Minor improvements to error messages Paul Eggleton
  2012-01-11 18:30 ` [PATCH 1/4] bitbake/knotty: don't count errors as warnings Paul Eggleton
  2012-01-11 18:30 ` [PATCH 2/4] bitbake: improve error formatting for fetcher errors Paul Eggleton
@ 2012-01-11 18:30 ` Paul Eggleton
  2012-01-11 18:30 ` [PATCH 4/4] bitbake/runqueue: avoid "failed" in task summary if nothing did Paul Eggleton
  2012-01-12 15:45 ` [PATCH 0/4] Minor improvements to error messages Paul Eggleton
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-01-11 18:30 UTC (permalink / raw)
  To: bitbake-devel

Instead of printing the full fetch command and output for the initial
fetch failure, just print a one-liner containing the URL. If the user
needs more detail the full version is still output as a debug message
which will go into the log.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/fetch2/__init__.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index b76358d..80cef3f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -977,7 +977,8 @@ class Fetch(object):
                         raise
 
                     except BBFetchException as e:
-                        logger.warn(str(e))
+                        logger.warn('Failed to fetch URL %s' % u)
+                        logger.debug(1, str(e))
                         # Remove any incomplete fetch
                         if os.path.isfile(ud.localpath):
                             bb.utils.remove(ud.localpath)
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] bitbake/runqueue: avoid "failed" in task summary if nothing did
  2012-01-11 18:30 [PATCH 0/4] Minor improvements to error messages Paul Eggleton
                   ` (2 preceding siblings ...)
  2012-01-11 18:30 ` [PATCH 3/4] bitbake: make warning for initial fetch failure one line Paul Eggleton
@ 2012-01-11 18:30 ` Paul Eggleton
  2012-01-12 15:45 ` [PATCH 0/4] Minor improvements to error messages Paul Eggleton
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-01-11 18:30 UTC (permalink / raw)
  To: bitbake-devel

Seeing the word "failed" alone without reading the whole context has
occasionally triggered an automatic assumption on the part of some users
(myself included) that something has gone wrong, even when this message
is telling you that "0 [tasks] failed". To avoid this let's just say
"all succeeded" in this case instead.

As a bonus this means you can now search the output for "fail" and not
find anything if all went well.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/runqueue.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 86744fb..054d36c 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -968,7 +968,11 @@ class RunQueue:
 
         if self.state is runQueueComplete:
             # All done
-            logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and %d failed.", self.rqexe.stats.completed, self.rqexe.stats.skipped, self.rqexe.stats.failed)
+            if self.rqexe.stats.failed:
+                logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and %d failed.", self.rqexe.stats.completed, self.rqexe.stats.skipped, self.rqexe.stats.failed)
+            else:
+                # Let's avoid the word "failed" if nothing actually did
+                logger.info("Tasks Summary: Attempted %d tasks of which %d didn't need to be rerun and all succeeded.", self.rqexe.stats.completed, self.rqexe.stats.skipped)
             return False
 
         if self.state is runQueueChildProcess:
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Minor improvements to error messages
  2012-01-11 18:30 [PATCH 0/4] Minor improvements to error messages Paul Eggleton
                   ` (3 preceding siblings ...)
  2012-01-11 18:30 ` [PATCH 4/4] bitbake/runqueue: avoid "failed" in task summary if nothing did Paul Eggleton
@ 2012-01-12 15:45 ` Paul Eggleton
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-01-12 15:45 UTC (permalink / raw)
  To: bitbake-devel

On Wednesday 11 January 2012 18:30:47 Paul Eggleton wrote:
> A few minor improvements to error output. I'm still working on some
> deeper improvements but these are ready to go in immediately.

Spoke a little too soon, I'd prefer to merge one of these patches into another 
I've been working on so please ignore this series.

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-12 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 18:30 [PATCH 0/4] Minor improvements to error messages Paul Eggleton
2012-01-11 18:30 ` [PATCH 1/4] bitbake/knotty: don't count errors as warnings Paul Eggleton
2012-01-11 18:30 ` [PATCH 2/4] bitbake: improve error formatting for fetcher errors Paul Eggleton
2012-01-11 18:30 ` [PATCH 3/4] bitbake: make warning for initial fetch failure one line Paul Eggleton
2012-01-11 18:30 ` [PATCH 4/4] bitbake/runqueue: avoid "failed" in task summary if nothing did Paul Eggleton
2012-01-12 15:45 ` [PATCH 0/4] Minor improvements to error messages Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.