summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-02-24 13:16:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 20:38:26 +0100
commit9f33dde6e71b7b66db357b1bf289ae63e0db77d2 (patch)
treecd7c2725432bc7e331cd4bf153aed888d425944e /bitbake
parent88f4ba28bcc95b64940bd465793a3bb50abf0693 (diff)
downloadast2050-yocto-poky-9f33dde6e71b7b66db357b1bf289ae63e0db77d2.zip
ast2050-yocto-poky-9f33dde6e71b7b66db357b1bf289ae63e0db77d2.tar.gz
cooker: use BBHandler.inherit for INHERIT
Ideally we'd avoid direct BBHandler usage, but honestly, to say the whole bb.parse abstraction is incredibly leaky is an understatement. If we try to make handle() not reparse classes, things get ugly fairly quickly, as inherit() calls handle() itself after adding the class to the inherit cache. This change fixes it so we no longer risk reparsing a class if: - it's listed in INHERIT multiple times - it's listed in INHERIT and is 'inherit'ed from a class in INHERIT (Bitbake rev: 057c3cddeb72584c6c3908bd702288cece9b66ea) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py34
1 files changed, 24 insertions, 10 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ad9af7b..b66d003 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -33,6 +33,7 @@ import sre_constants
import threading
from cStringIO import StringIO
from contextlib import closing
+from functools import wraps
import bb, bb.exceptions
from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
@@ -637,13 +638,6 @@ class BBCooker:
path, _ = os.path.split(path)
def parseConfigurationFiles(self, files):
- def _parse(f, data, include=False):
- try:
- return bb.parse.handle(f, data, include)
- except (IOError, bb.parse.ParseError) as exc:
- parselog.critical("Unable to parse %s: %s" % (f, exc))
- sys.exit(1)
-
data = self.configuration.data
bb.parse.init_parser(data)
for f in files:
@@ -671,9 +665,9 @@ class BBCooker:
data = _parse(os.path.join("conf", "bitbake.conf"), data)
# Handle any INHERITs and inherit the base class
- inherits = ["base"] + (data.getVar('INHERIT', True) or "").split()
- for inherit in inherits:
- data = _parse(os.path.join('classes', '%s.bbclass' % inherit), data, True)
+ bbclasses = ["base"] + (data.getVar('INHERIT', True) or "").split()
+ for bbclass in bbclasses:
+ data = _inherit(bbclass, data)
# Nomally we only register event handlers at the end of parsing .bb files
# We register any handlers we've found so far here...
@@ -1123,6 +1117,26 @@ class CookerExit(bb.event.Event):
def __init__(self):
bb.event.Event.__init__(self)
+def catch_parse_error(func):
+ """Exception handling bits for our parsing"""
+ @wraps(func)
+ def wrapped(fn, *args):
+ try:
+ return func(fn, *args)
+ except (IOError, bb.parse.ParseError, bb.data_smart.ExpansionError) as exc:
+ parselog.critical("Unable to parse %s: %s" % (fn, exc))
+ sys.exit(1)
+ return wrapped
+
+@catch_parse_error
+def _parse(fn, data, include=False):
+ return bb.parse.handle(fn, data, include)
+
+@catch_parse_error
+def _inherit(bbclass, data):
+ bb.parse.BBHandler.inherit([bbclass], data)
+ return data
+
class ParsingFailure(Exception):
def __init__(self, realexception, recipe):
self.realexception = realexception
OpenPOWER on IntegriCloud