summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-01-13 17:01:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-15 10:06:22 +0000
commit9fd17bbe1ca3894437a16a625e05334dc97c5273 (patch)
tree2d5111d70818c89e9d3cad4060b91c88ee88d000 /bitbake/lib/bb/cooker.py
parent5f5ae14ee398d1e1a3b17749dff929ae4a48dcdf (diff)
downloadpoky-9fd17bbe1ca3894437a16a625e05334dc97c5273.tar.gz
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] (Bitbake rev: 803550a5098ec878164245e71344c3d687310b72) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 194046ea91..6041410575 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -44,9 +44,9 @@ buildlog = logging.getLogger("BitBake.Build")
44parselog = logging.getLogger("BitBake.Parsing") 44parselog = logging.getLogger("BitBake.Parsing")
45providerlog = logging.getLogger("BitBake.Provider") 45providerlog = logging.getLogger("BitBake.Provider")
46 46
47class MultipleMatches(Exception): 47class NoSpecificMatch(bb.BBHandledException):
48 """ 48 """
49 Exception raised when multiple file matches are found 49 Exception raised when no or multiple file matches are found
50 """ 50 """
51 51
52class NothingToBuild(Exception): 52class NothingToBuild(Exception):
@@ -979,10 +979,15 @@ class BBCooker:
979 """ 979 """
980 matches = self.matchFiles(buildfile) 980 matches = self.matchFiles(buildfile)
981 if len(matches) != 1: 981 if len(matches) != 1:
982 parselog.error("Unable to match %s (%s matches found):" % (buildfile, len(matches))) 982 if matches:
983 for f in matches: 983 msg = "Unable to match '%s' to a specific recipe file - %s matches found:" % (buildfile, len(matches))
984 parselog.error(" %s" % f) 984 if matches:
985 raise MultipleMatches 985 for f in matches:
986 msg += "\n %s" % f
987 parselog.error(msg)
988 else:
989 parselog.error("Unable to find any recipe file matching '%s'" % buildfile)
990 raise NoSpecificMatch
986 return matches[0] 991 return matches[0]
987 992
988 def buildFile(self, buildfile, task): 993 def buildFile(self, buildfile, task):