diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 5a086b4e95..ea1096f2de 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -340,9 +340,7 @@ class InheritDeferredNode(AstNode): self.inherit = (classes, filename, lineno) def eval(self, data): - inherits = data.getVar('__BBDEFINHERITS', False) or [] - inherits.append(self.inherit) - data.setVar('__BBDEFINHERITS', inherits) + bb.parse.BBHandler.inherit_defer(*self.inherit, data) class AddFragmentsNode(AstNode): def __init__(self, filename, lineno, fragments_path_prefix, fragments_variable, flagged_variables_list_variable): @@ -571,9 +569,7 @@ def multi_finalize(fn, d): d.setVar("BBEXTENDVARIANT", variantmap[name]) else: d.setVar("PN", "%s-%s" % (pn, name)) - inherits = d.getVar('__BBDEFINHERITS', False) or [] - inherits.append((extendedmap[name], fn, 0)) - d.setVar('__BBDEFINHERITS', inherits) + bb.parse.BBHandler.inherit_defer(extendedmap[name], fn, 0, d) safe_d.setVar("BBCLASSEXTEND", extended) _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise) diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 4bdb11994f..008fec2308 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -42,12 +42,22 @@ def supports(fn, d): """Return True if fn has a supported extension""" return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] +def inherit_defer(expression, fn, lineno, d): + inherit = (expression, fn, lineno) + inherits = d.getVar('__BBDEFINHERITS', False) or [] + inherits.append(inherit) + d.setVar('__BBDEFINHERITS', inherits) + def inherit(files, fn, lineno, d, deferred=False): __inherit_cache = d.getVar('__inherit_cache', False) or [] #if "${" in files and not deferred: # bb.warn("%s:%s has non deferred conditional inherit" % (fn, lineno)) files = d.expand(files).split() for file in files: + defer = (d.getVar("BB_DEFER_BBCLASSES") or "").split() + if not deferred and file in defer: + inherit_defer(file, fn, lineno, d) + continue classtype = d.getVar("__bbclasstype", False) origfile = file for t in ["classes-" + classtype, "classes"]: