[bitbake-devel] [PATCH 07/10] bitbake: add -R option for loading configuration files after bitbake.conf

Joshua Lock josh at linux.intel.com
Fri Jul 1 06:02:53 UTC 2011


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.

Signed-off-by: Joshua Lock <josh at linux.intel.com>
---
 bin/bitbake      |    5 ++++-
 lib/bb/cooker.py |   13 ++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/bin/bitbake b/bin/bitbake
index d577e05..206d97b 100755
--- a/bin/bitbake
+++ b/bin/bitbake
@@ -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)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index f0c94fa..13e898e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -126,7 +126,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:
@@ -682,10 +683,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()
@@ -709,6 +712,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:
-- 
1.7.5.4





More information about the bitbake-devel mailing list