bitbake: add -R option for loading configuration files after bitbake.conf

Useful if you want to load a configuration file that sets values which may
also be set in bitbake.conf or one of the files it includes.

(Bitbake rev: a8246ae5400c23df0d3ee29c36f4d9f257d1e6d1)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2011-06-30 23:02:53 -07:00 committed by Richard Purdie
parent 22d8fb1fc3
commit f3be8e9a7d
2 changed files with 14 additions and 4 deletions

View File

@ -118,7 +118,10 @@ Default BBFILES are the .bb files in the current directory.""")
action = "store", dest = "cmd")
parser.add_option("-r", "--read", help = "read the specified file before bitbake.conf",
action = "append", dest = "file", default = [])
action = "append", dest = "prefile", default = [])
parser.add_option("-R", "--postread", help = "read the specified file after bitbake.conf",
action = "append", dest = "postfile", default = [])
parser.add_option("-v", "--verbose", help = "output more chit-chat to the terminal",
action = "store_true", dest = "verbose", default = False)

View File

@ -129,7 +129,8 @@ class BBCooker:
bb.data.inheritFromOS(self.configuration.data)
try:
self.parseConfigurationFiles(self.configuration.file)
self.parseConfigurationFiles(self.configuration.prefile,
self.configuration.postfile)
except SyntaxError:
sys.exit(1)
except Exception:
@ -653,10 +654,12 @@ class BBCooker:
def _findLayerConf(self):
return self._findConfigFile("bblayers.conf")
def parseConfigurationFiles(self, files):
def parseConfigurationFiles(self, prefiles, postfiles):
data = self.configuration.data
bb.parse.init_parser(data)
for f in files:
# Parse files for loading *before* bitbake.conf and any includes
for f in prefiles:
data = _parse(f, data)
layerconf = self._findLayerConf()
@ -680,6 +683,10 @@ class BBCooker:
data = _parse(os.path.join("conf", "bitbake.conf"), data)
# Parse files for loading *after* bitbake.conf and any includes
for p in postfiles:
data = _parse(p, data)
# Handle any INHERITs and inherit the base class
bbclasses = ["base"] + (data.getVar('INHERIT', True) or "").split()
for bbclass in bbclasses: