[bitbake-devel] [PATCH] bitbake: Allow environment variables and ~ in bblayers
Christopher Larson
clarson at kergoth.com
Wed Apr 15 19:38:54 UTC 2015
On Wed, Apr 15, 2015 at 7:43 AM, Ed Bartosh <ed.bartosh at linux.intel.com>
wrote:
> Enabled processing of environment variables in bblayers paths using
> bitbake apporved_variables API.
>
> Enabled processing of ~ if HOME environment variable is approved.
>
> Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
> ---
> bitbake/lib/bb/cookerdata.py | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
> index 6c11a60..05b3986 100644
> --- a/bitbake/lib/bb/cookerdata.py
> +++ b/bitbake/lib/bb/cookerdata.py
> @@ -25,6 +25,7 @@
> import os, sys
> from functools import wraps
> import logging
> +import string
> import bb
> from bb import data
> import bb.parse
> @@ -269,8 +270,13 @@ class CookerDataBuilder(object):
> layers = (data.getVar('BBLAYERS', True) or "").split()
>
> data = bb.data.createCopy(data)
> + approved = dict((var, data.getVar(var, True)) \
> + for var in bb
> .utils.approved_variables())
> for layer in layers:
> parselog.debug(2, "Adding layer %s", layer)
> + layer = string.Template(layer).safe_substitute(approved)
> + if 'HOME' in approved:
> + layer = os.path.expanduser(layer)
> data.setVar('LAYERDIR', layer)
> data = parse_config_file(os.path.join(layer, "conf",
> "layer.conf"), data)
> data.expandVarref('LAYERDIR')
>
Why the use of string.Template here? We already have a variable expansion
mechanism.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20150415/d8b7edec/attachment-0002.html>
More information about the bitbake-devel
mailing list