All of lore.kernel.org
 help / color / mirror / Atom feed
* [layerindex-web][PATCH 1/3] utils.py: split out parse_conf() from parse_layer_conf()
@ 2017-03-14  2:19 Paul Eggleton
  2017-03-14  2:19 ` [layerindex-web][PATCH 2/3] update_layer.py: use DISTRO_NAME as primary distro short description Paul Eggleton
  2017-03-14  2:19 ` [layerindex-web][PATCH 3/3] layerindex: add "No update" status to LayerItem Paul Eggleton
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2017-03-14  2:19 UTC (permalink / raw)
  To: yocto

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@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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-14  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14  2:19 [layerindex-web][PATCH 1/3] utils.py: split out parse_conf() from parse_layer_conf() Paul Eggleton
2017-03-14  2:19 ` [layerindex-web][PATCH 2/3] update_layer.py: use DISTRO_NAME as primary distro short description Paul Eggleton
2017-03-14  2:19 ` [layerindex-web][PATCH 3/3] layerindex: add "No update" status to LayerItem Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.