From: git@git.openembedded.org
To: bitbake-devel@lists.openembedded.org
Subject: Paul Eggleton : bitbake/cooker: avoid printing stack trace for -b match error
Date: Sun, 15 Jan 2012 10:15:11 +0000 (UTC) [thread overview]
Message-ID: <20120115101511.446711033C@opal> (raw)
Module: bitbake.git
Branch: master
Commit: 803550a5098ec878164245e71344c3d687310b72
URL: http://git.openembedded.org/?p=bitbake.git&a=commit;h=803550a5098ec878164245e71344c3d687310b72
Author: Paul Eggleton <paul.eggleton@linux.intel.com>
Date: Fri Jan 13 17:01:51 2012 +0000
bitbake/cooker: avoid printing stack trace for -b match error
Improves error output for matching problems when the -b / --buildfile
command line option is used.
Rename MultipleMatches exception to NoSpecificMatch (as it is also
raised when there are no matching recipes) and make it inherit from
BBHandledException so that it doesn't print a stack trace (we always log
an ERROR prior to raising it.)
In addition, improve the formatting of the error message - only call the
log function once rather than once for every match, and use a more
appropriate message if there are no matches.
Fixes [YOCTO #1141]
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
lib/bb/cooker.py | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 194046e..6041410 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -44,9 +44,9 @@ buildlog = logging.getLogger("BitBake.Build")
parselog = logging.getLogger("BitBake.Parsing")
providerlog = logging.getLogger("BitBake.Provider")
-class MultipleMatches(Exception):
+class NoSpecificMatch(bb.BBHandledException):
"""
- Exception raised when multiple file matches are found
+ Exception raised when no or multiple file matches are found
"""
class NothingToBuild(Exception):
@@ -979,10 +979,15 @@ class BBCooker:
"""
matches = self.matchFiles(buildfile)
if len(matches) != 1:
- parselog.error("Unable to match %s (%s matches found):" % (buildfile, len(matches)))
- for f in matches:
- parselog.error(" %s" % f)
- raise MultipleMatches
+ if matches:
+ msg = "Unable to match '%s' to a specific recipe file - %s matches found:" % (buildfile, len(matches))
+ if matches:
+ for f in matches:
+ msg += "\n %s" % f
+ parselog.error(msg)
+ else:
+ parselog.error("Unable to find any recipe file matching '%s'" % buildfile)
+ raise NoSpecificMatch
return matches[0]
def buildFile(self, buildfile, task):
reply other threads:[~2012-01-15 10:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20120115101511.446711033C@opal \
--to=git@git.openembedded.org \
--cc=bitbake-devel@lists.openembedded.org \
/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 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.