[yocto] [layerindex-web][PATCH 1/3] utils.py: split out parse_conf() from parse_layer_conf()

Paul Eggleton paul.eggleton at linux.intel.com
Mon Mar 13 19:19:57 PDT 2017


If we want to parse a configuration file (e.g. a distro conf file) then
we need convenient access to bitbake's conf parsing code, so create a
parse_conf() function to provide that.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
 layerindex/utils.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/layerindex/utils.py b/layerindex/utils.py
index 50734fc..3b45b07 100644
--- a/layerindex/utils.py
+++ b/layerindex/utils.py
@@ -160,6 +160,15 @@ def is_layer_valid(layerdir):
         return False
     return True
 
+def parse_conf(conf_file, d):
+    if hasattr(bb.parse, "handle"):
+        # Newer BitBake
+        data = bb.parse.handle(conf_file, d, include=True)
+    else:
+        # Older BitBake (1.18 and below)
+        data = bb.cooker._parse(conf_file, d)
+    return data
+
 def parse_layer_conf(layerdir, data, logger=None):
     conf_file = os.path.join(layerdir, "conf", "layer.conf")
 
@@ -169,12 +178,7 @@ def parse_layer_conf(layerdir, data, logger=None):
         return
 
     data.setVar('LAYERDIR', str(layerdir))
-    if hasattr(bb, "cookerdata"):
-        # Newer BitBake
-        data = bb.cookerdata.parse_config_file(conf_file, data)
-    else:
-        # Older BitBake (1.18 and below)
-        data = bb.cooker._parse(conf_file, data)
+    data = parse_conf(conf_file, data)
     data.expandVarref('LAYERDIR')
 
 def runcmd(cmd, destdir=None, printerr=True, logger=None):
-- 
2.9.3




More information about the yocto mailing list