cooker: show a useful message for ParsingFailure

(Bitbake rev: a41c217c6e9195f8b9ea2de6e1d335b10b904558)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chris Larson
2011-05-05 16:50:34 -07:00
committed by Richard Purdie
parent 2cf67a71e3
commit 36d1dcef65

View File

@@ -33,7 +33,7 @@ import sre_constants
import threading import threading
from cStringIO import StringIO from cStringIO import StringIO
from contextlib import closing from contextlib import closing
import bb import bb, bb.exceptions
from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
logger = logging.getLogger("BitBake") logger = logging.getLogger("BitBake")
@@ -1122,8 +1122,7 @@ class ParsingFailure(Exception):
def __init__(self, realexception, recipe): def __init__(self, realexception, recipe):
self.realexception = realexception self.realexception = realexception
self.recipe = recipe self.recipe = recipe
Exception.__init__(self, "Failure when parsing %s" % recipe) Exception.__init__(self, realexception, recipe)
self.args = (realexception, recipe)
def parse_file(task): def parse_file(task):
filename, appends, caches_array = task filename, appends, caches_array = task
@@ -1216,6 +1215,10 @@ class CookerParser(object):
except KeyboardInterrupt: except KeyboardInterrupt:
self.shutdown(clean=False) self.shutdown(clean=False)
raise raise
except ParsingFailure as exc:
self.shutdown(clean=False)
bb.fatal('Error parsing %s: %s' %
(exc.recipe, bb.exceptions.to_string(exc.realexception)))
except Exception as exc: except Exception as exc:
self.shutdown(clean=False) self.shutdown(clean=False)
bb.fatal('Error parsing %s: %s' % (exc.recipe, exc)) bb.fatal('Error parsing %s: %s' % (exc.recipe, exc))