@@ -326,6 +326,20 @@ class InheritDeferredNode(AstNode):
inherits.append(self.inherit)
data.setVar('__BBDEFINHERITS', inherits)
+class AddFragmentsNode(AstNode):
+ def __init__(self, filename, lineno, fragments_path_prefix, fragments_variable):
+ AstNode.__init__(self, filename, lineno)
+ self.path = fragments_path_prefix
+ self.variable = fragments_variable
+
+ def eval(self, data):
+ fragments = data.getVar(self.variable)
+ if not fragments:
+ return
+ for f in fragments.split():
+ full_fragment_name = data.expand("{}/{}.conf".format(self.path, f))
+ bb.parse.ConfHandler.include(self.filename, full_fragment_name, self.lineno, data, "include fragment")
+
def handleInclude(statements, filename, lineno, m, force):
statements.append(IncludeNode(filename, lineno, m.group(1), force))
@@ -370,6 +384,11 @@ def handleInheritDeferred(statements, filename, lineno, m):
classes = m.group(1)
statements.append(InheritDeferredNode(filename, lineno, classes))
+def handleAddFragments(statements, filename, lineno, m):
+ fragments_path_prefix = m.group(1)
+ fragments_variable = m.group(2)
+ statements.append(AddFragmentsNode(filename, lineno, fragments_path_prefix, fragments_variable))
+
def runAnonFuncs(d):
code = []
for funcname in d.getVar("__BBANONFUNCS", False) or []:
@@ -47,6 +47,7 @@ __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" )
__unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" )
__unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\]$" )
__addpylib_regexp__ = re.compile(r"addpylib\s+(.+)\s+(.+)" )
+__addfragments_regexp__ = re.compile(r"addfragments\s+(.+)\s+(.+)" )
def init(data):
return
@@ -197,6 +198,11 @@ def feeder(lineno, s, fn, statements, baseconfig=False, conffile=True):
ast.handlePyLib(statements, fn, lineno, m)
return
+ m = __addfragments_regexp__.match(s)
+ if m:
+ ast.handleAddFragments(statements, fn, lineno, m)
+ return
+
raise ParseError("unparsed line: '%s'" % s, fn, lineno);
# Add us to the handlers list