From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Robert Yang <liezhi.yang@windriver.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
Date: Mon, 13 Jan 2014 23:07:41 +0000 [thread overview]
Message-ID: <1389654461.14987.32.camel@ted> (raw)
In-Reply-To: <69aa90ef3b947f39f49563b84a10c226d7df61d8.1389601138.git.liezhi.yang@windriver.com>
On Mon, 2014-01-13 at 03:19 -0500, Robert Yang wrote:
> 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@windriver.com>
> ---
> bitbake/lib/bb/data.py | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
Should we do this just for PREFERRED_VERSION or all environment
variables? I can't think of a case we'd use __ currently but I can think
of other variable names where this mapping would help...
Any strong opinions?
Cheers,
Richard
> 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:
next prev parent reply other threads:[~2014-01-13 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 8:19 [PATCH 0/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION Robert Yang
2014-01-13 8:19 ` [PATCH 1/1] " Robert Yang
2014-01-13 11:15 ` Gary Thomas
2014-01-14 1:44 ` Robert Yang
2014-01-13 23:07 ` Richard Purdie [this message]
2014-01-14 1:45 ` Robert Yang
2014-01-14 2:38 ` Robert Yang
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=1389654461.14987.32.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
--cc=liezhi.yang@windriver.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox