diff options
| -rw-r--r-- | bitbake/lib/bb/parse/ast.py | 22 | ||||
| -rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 10 |
2 files changed, 31 insertions, 1 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index d30b688965..7581d003fd 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
| @@ -314,6 +314,16 @@ class InheritNode(AstNode): | |||
| 314 | def eval(self, data): | 314 | def eval(self, data): |
| 315 | bb.parse.BBHandler.inherit(self.classes, self.filename, self.lineno, data) | 315 | bb.parse.BBHandler.inherit(self.classes, self.filename, self.lineno, data) |
| 316 | 316 | ||
| 317 | class InheritDeferredNode(AstNode): | ||
| 318 | def __init__(self, filename, lineno, classes): | ||
| 319 | AstNode.__init__(self, filename, lineno) | ||
| 320 | self.inherit = (classes, filename, lineno) | ||
| 321 | |||
| 322 | def eval(self, data): | ||
| 323 | inherits = data.getVar('__BBDEFINHERITS', False) or [] | ||
| 324 | inherits.append(self.inherit) | ||
| 325 | data.setVar('__BBDEFINHERITS', inherits) | ||
| 326 | |||
| 317 | def handleInclude(statements, filename, lineno, m, force): | 327 | def handleInclude(statements, filename, lineno, m, force): |
| 318 | statements.append(IncludeNode(filename, lineno, m.group(1), force)) | 328 | statements.append(IncludeNode(filename, lineno, m.group(1), force)) |
| 319 | 329 | ||
| @@ -364,6 +374,10 @@ def handleInherit(statements, filename, lineno, m): | |||
| 364 | classes = m.group(1) | 374 | classes = m.group(1) |
| 365 | statements.append(InheritNode(filename, lineno, classes)) | 375 | statements.append(InheritNode(filename, lineno, classes)) |
| 366 | 376 | ||
| 377 | def handleInheritDeferred(statements, filename, lineno, m): | ||
| 378 | classes = m.group(1) | ||
| 379 | statements.append(InheritDeferredNode(filename, lineno, classes)) | ||
| 380 | |||
| 367 | def runAnonFuncs(d): | 381 | def runAnonFuncs(d): |
| 368 | code = [] | 382 | code = [] |
| 369 | for funcname in d.getVar("__BBANONFUNCS", False) or []: | 383 | for funcname in d.getVar("__BBANONFUNCS", False) or []: |
| @@ -430,6 +444,14 @@ def multi_finalize(fn, d): | |||
| 430 | logger.debug("Appending .bbappend file %s to %s", append, fn) | 444 | logger.debug("Appending .bbappend file %s to %s", append, fn) |
| 431 | bb.parse.BBHandler.handle(append, d, True) | 445 | bb.parse.BBHandler.handle(append, d, True) |
| 432 | 446 | ||
| 447 | while True: | ||
| 448 | inherits = d.getVar('__BBDEFINHERITS', False) or [] | ||
| 449 | if not inherits: | ||
| 450 | break | ||
| 451 | inherit, filename, lineno = inherits.pop(0) | ||
| 452 | d.setVar('__BBDEFINHERITS', inherits) | ||
| 453 | bb.parse.BBHandler.inherit(inherit, filename, lineno, d, deferred=True) | ||
| 454 | |||
| 433 | onlyfinalise = d.getVar("__ONLYFINALISE", False) | 455 | onlyfinalise = d.getVar("__ONLYFINALISE", False) |
| 434 | 456 | ||
| 435 | safe_d = d | 457 | safe_d = d |
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 4d5b45e1ef..cd1c998f8f 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
| @@ -21,6 +21,7 @@ from .ConfHandler import include, init | |||
| 21 | 21 | ||
| 22 | __func_start_regexp__ = re.compile(r"(((?P<py>python(?=(\s|\()))|(?P<fr>fakeroot(?=\s)))\s*)*(?P<func>[\w\.\-\+\{\}\$:]+)?\s*\(\s*\)\s*{$" ) | 22 | __func_start_regexp__ = re.compile(r"(((?P<py>python(?=(\s|\()))|(?P<fr>fakeroot(?=\s)))\s*)*(?P<func>[\w\.\-\+\{\}\$:]+)?\s*\(\s*\)\s*{$" ) |
| 23 | __inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) | 23 | __inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) |
| 24 | __inherit_def_regexp__ = re.compile(r"inherit_defer\s+(.+)" ) | ||
| 24 | __export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) | 25 | __export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) |
| 25 | __addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") | 26 | __addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") |
| 26 | __deltask_regexp__ = re.compile(r"deltask\s+(.+)") | 27 | __deltask_regexp__ = re.compile(r"deltask\s+(.+)") |
| @@ -40,8 +41,10 @@ def supports(fn, d): | |||
| 40 | """Return True if fn has a supported extension""" | 41 | """Return True if fn has a supported extension""" |
| 41 | return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] | 42 | return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] |
| 42 | 43 | ||
| 43 | def inherit(files, fn, lineno, d): | 44 | def inherit(files, fn, lineno, d, deferred=False): |
| 44 | __inherit_cache = d.getVar('__inherit_cache', False) or [] | 45 | __inherit_cache = d.getVar('__inherit_cache', False) or [] |
| 46 | #if "${" in files and not deferred: | ||
| 47 | # bb.warn("%s:%s has non deferred conditional inherit" % (fn, lineno)) | ||
| 45 | files = d.expand(files).split() | 48 | files = d.expand(files).split() |
| 46 | for file in files: | 49 | for file in files: |
| 47 | classtype = d.getVar("__bbclasstype", False) | 50 | classtype = d.getVar("__bbclasstype", False) |
| @@ -265,6 +268,11 @@ def feeder(lineno, s, fn, root, statements, eof=False): | |||
| 265 | ast.handleInherit(statements, fn, lineno, m) | 268 | ast.handleInherit(statements, fn, lineno, m) |
| 266 | return | 269 | return |
| 267 | 270 | ||
| 271 | m = __inherit_def_regexp__.match(s) | ||
| 272 | if m: | ||
| 273 | ast.handleInheritDeferred(statements, fn, lineno, m) | ||
| 274 | return | ||
| 275 | |||
| 268 | return ConfHandler.feeder(lineno, s, fn, statements, conffile=False) | 276 | return ConfHandler.feeder(lineno, s, fn, statements, conffile=False) |
| 269 | 277 | ||
| 270 | # Add us to the handlers list | 278 | # Add us to the handlers list |
