summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/command.py7
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py11
2 files changed, 18 insertions, 0 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 73aaca0474..fd8912ab40 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -179,6 +179,13 @@ class CommandsSync:
179 """ 179 """
180 return bb.utils.cpu_count() 180 return bb.utils.cpu_count()
181 181
182 def setConfFilter(self, command, params):
183 """
184 Set the configuration file parsing filter
185 """
186 filterfunc = params[0]
187 bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc)
188
182class CommandsAsync: 189class CommandsAsync:
183 """ 190 """
184 A class of asynchronous commands 191 A class of asynchronous commands
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index fa811f3828..6f77bd4201 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -71,6 +71,14 @@ def include(oldfn, fn, lineno, data, error_out):
71 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) 71 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
72 logger.debug(2, "CONF file '%s' not found", fn) 72 logger.debug(2, "CONF file '%s' not found", fn)
73 73
74# We have an issue where a UI might want to enforce particular settings such as
75# an empty DISTRO variable. If configuration files do something like assigning
76# a weak default, it turns out to be very difficult to filter out these changes,
77# particularly when the weak default might appear half way though parsing a chain
78# of configuration files. We therefore let the UIs hook into configuration file
79# parsing. This turns out to be a hard problem to solve any other way.
80confFilters = []
81
74def handle(fn, data, include): 82def handle(fn, data, include):
75 init(data) 83 init(data)
76 84
@@ -107,6 +115,9 @@ def handle(fn, data, include):
107 if oldfile: 115 if oldfile:
108 data.setVar('FILE', oldfile) 116 data.setVar('FILE', oldfile)
109 117
118 for f in confFilters:
119 f(fn, data)
120
110 return data 121 return data
111 122
112def feeder(lineno, s, fn, statements): 123def feeder(lineno, s, fn, statements):