diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-12-14 20:03:17 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-12-17 11:48:25 +0000 |
commit | 5cb3d1a59cb423cc672720f797236578cac19628 (patch) | |
tree | 4068ee630e37f0281c4edd1e26edea45c1f7dbe3 /bitbake | |
parent | 9d1b31d2542e50afe8d832588a4858054278e66c (diff) | |
download | poky-5cb3d1a59cb423cc672720f797236578cac19628.tar.gz |
bitbake: parse: Add include_all conf file directive
In some cases it would be helpful to be able to have an include file
in a standard location which is included in all layers that are added
to the system. The intent is for these to provide configuration tweaks
of specific types so that a given file pattern can be adopted more widely
for such configuration.
The code will search for any named configuration file within BBPATH, so
a configuration directive of:
include_all conf/distro/include/myinc.conf
would include the myinc.conf file in that subpath if present in any
directory in BBPATH. Multiple files will be included if present.
(Bitbake rev: d01d5593e7829ac60f37bc23cb87dc6917026471)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 18 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 6 |
2 files changed, 24 insertions, 0 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 03370180e3..2f6c6a0055 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -43,6 +43,21 @@ class IncludeNode(AstNode): | |||
43 | else: | 43 | else: |
44 | bb.parse.ConfHandler.include(self.filename, s, self.lineno, data, False) | 44 | bb.parse.ConfHandler.include(self.filename, s, self.lineno, data, False) |
45 | 45 | ||
46 | class IncludeAllNode(AstNode): | ||
47 | def __init__(self, filename, lineno, what_file): | ||
48 | AstNode.__init__(self, filename, lineno) | ||
49 | self.what_file = what_file | ||
50 | |||
51 | def eval(self, data): | ||
52 | """ | ||
53 | Include the file and evaluate the statements | ||
54 | """ | ||
55 | s = data.expand(self.what_file) | ||
56 | logger.debug2("CONF %s:%s: including %s", self.filename, self.lineno, s) | ||
57 | |||
58 | for path in data.getVar("BBPATH").split(":"): | ||
59 | bb.parse.ConfHandler.include(self.filename, os.path.join(path, s), self.lineno, data, False) | ||
60 | |||
46 | class ExportNode(AstNode): | 61 | class ExportNode(AstNode): |
47 | def __init__(self, filename, lineno, var): | 62 | def __init__(self, filename, lineno, var): |
48 | AstNode.__init__(self, filename, lineno) | 63 | AstNode.__init__(self, filename, lineno) |
@@ -366,6 +381,9 @@ class AddFragmentsNode(AstNode): | |||
366 | def handleInclude(statements, filename, lineno, m, force): | 381 | def handleInclude(statements, filename, lineno, m, force): |
367 | statements.append(IncludeNode(filename, lineno, m.group(1), force)) | 382 | statements.append(IncludeNode(filename, lineno, m.group(1), force)) |
368 | 383 | ||
384 | def handleIncludeAll(statements, filename, lineno, m): | ||
385 | statements.append(IncludeAllNode(filename, lineno, m.group(1))) | ||
386 | |||
369 | def handleExport(statements, filename, lineno, m): | 387 | def handleExport(statements, filename, lineno, m): |
370 | statements.append(ExportNode(filename, lineno, m.group(1))) | 388 | statements.append(ExportNode(filename, lineno, m.group(1))) |
371 | 389 | ||
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index d0711eda04..24f81f7e9e 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -43,6 +43,7 @@ __config_regexp__ = re.compile( r""" | |||
43 | """, re.X) | 43 | """, re.X) |
44 | __include_regexp__ = re.compile( r"include\s+(.+)" ) | 44 | __include_regexp__ = re.compile( r"include\s+(.+)" ) |
45 | __require_regexp__ = re.compile( r"require\s+(.+)" ) | 45 | __require_regexp__ = re.compile( r"require\s+(.+)" ) |
46 | __includeall_regexp__ = re.compile( r"include_all\s+(.+)" ) | ||
46 | __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) | 47 | __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) |
47 | __unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) | 48 | __unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) |
48 | __unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\]$" ) | 49 | __unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\]$" ) |
@@ -178,6 +179,11 @@ def feeder(lineno, s, fn, statements, baseconfig=False, conffile=True): | |||
178 | ast.handleInclude(statements, fn, lineno, m, True) | 179 | ast.handleInclude(statements, fn, lineno, m, True) |
179 | return | 180 | return |
180 | 181 | ||
182 | m = __includeall_regexp__.match(s) | ||
183 | if m: | ||
184 | ast.handleIncludeAll(statements, fn, lineno, m) | ||
185 | return | ||
186 | |||
181 | m = __export_regexp__.match(s) | 187 | m = __export_regexp__.match(s) |
182 | if m: | 188 | if m: |
183 | ast.handleExport(statements, fn, lineno, m) | 189 | ast.handleExport(statements, fn, lineno, m) |