summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-13 11:51:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-13 12:04:18 +0100
commit302f2cc8ce756ab61042f1d904df4d18071a976a (patch)
tree78b753507109222f0c902502573a1137a02cd4ec /bitbake
parent6703173449ad21e1623ac75a66535cb2ed52aeeb (diff)
downloadpoky-302f2cc8ce756ab61042f1d904df4d18071a976a.tar.gz
ConfHandler.py: Add a hook for config parsing
To make the UI settings take effect, we need to hook at the end of each config file parsing and set UI specific values. (Bitbake rev: f54e733c7863110896f43900d9e4e791602f9d65) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-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):