From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: yocto@yoctoproject.org
Subject: [layerindex-web][PATCH 1/3] utils.py: split out parse_conf() from parse_layer_conf()
Date: Tue, 14 Mar 2017 15:19:57 +1300 [thread overview]
Message-ID: <20170314021959.12676-1-paul.eggleton@linux.intel.com> (raw)
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
next reply other threads:[~2017-03-14 2:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 2:19 Paul Eggleton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170314021959.12676-1-paul.eggleton@linux.intel.com \
--to=paul.eggleton@linux.intel.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.