[bitbake-devel] [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
Robert Yang
liezhi.yang at windriver.com
Mon Jan 13 08:19:56 UTC 2014
We can set the PREFERRED_VERSION from the command line:
$ export BB_PRESERVE_ENV=1
$ PREFERRED_VERSION_recipe="pv" bitbake recipe
But it doesn't work if the recipe name contain the "-" since we can't
use "-" in shell's variable name, use '__' instead of '-' in the env
will make it work.
We also need update the doc, I will mark the bug as "doc changes
required".
[YOCTO #4965]
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
bitbake/lib/bb/data.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 5840803..666cdcb 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -171,11 +171,20 @@ def expandKeys(alterdata, readdata = None):
def inheritFromOS(d, savedenv, permitted):
"""Inherit variables from the initial environment."""
+ # We can set the PREFERRED_VERSION_recipe from the shell env, but we
+ # can't use "-" in shell's variable name, so we use '__' instead of
+ # '-' in the env, and translate it back here.
+ preferred_version_re = re.compile('PREFERRED_VERSION_.*__')
+
exportlist = bb.utils.preserved_envvars_exported()
for s in savedenv.keys():
if s in permitted:
try:
- d.setVar(s, getVar(s, savedenv, True), op = 'from env')
+ if preferred_version_re.match(s):
+ s_new = s.replace('__', '-')
+ d.setVar(s_new, getVar(s, savedenv, True), op = 'from env')
+ else:
+ d.setVar(s, getVar(s, savedenv, True), op = 'from env')
if s in exportlist:
d.setVarFlag(s, "export", True, op = 'auto env export')
except TypeError:
--
1.7.10.4
More information about the bitbake-devel
mailing list