diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-13 11:51:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-13 12:04:18 +0100 |
commit | 302f2cc8ce756ab61042f1d904df4d18071a976a (patch) | |
tree | 78b753507109222f0c902502573a1137a02cd4ec | |
parent | 6703173449ad21e1623ac75a66535cb2ed52aeeb (diff) | |
download | ast2050-yocto-poky-302f2cc8ce756ab61042f1d904df4d18071a976a.zip ast2050-yocto-poky-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>
-rw-r--r-- | bitbake/lib/bb/command.py | 7 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index 73aaca0..fd8912a 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py @@ -179,6 +179,13 @@ class CommandsSync: """ return bb.utils.cpu_count() + def setConfFilter(self, command, params): + """ + Set the configuration file parsing filter + """ + filterfunc = params[0] + bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc) + class CommandsAsync: """ 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 fa811f3..6f77bd4 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): raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) logger.debug(2, "CONF file '%s' not found", fn) +# We have an issue where a UI might want to enforce particular settings such as +# an empty DISTRO variable. If configuration files do something like assigning +# a weak default, it turns out to be very difficult to filter out these changes, +# particularly when the weak default might appear half way though parsing a chain +# of configuration files. We therefore let the UIs hook into configuration file +# parsing. This turns out to be a hard problem to solve any other way. +confFilters = [] + def handle(fn, data, include): init(data) @@ -107,6 +115,9 @@ def handle(fn, data, include): if oldfile: data.setVar('FILE', oldfile) + for f in confFilters: + f(fn, data) + return data def feeder(lineno, s, fn, statements): |