* [PATCH 0/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
@ 2014-01-13 8:19 Robert Yang
2014-01-13 8:19 ` [PATCH 1/1] " Robert Yang
0 siblings, 1 reply; 7+ messages in thread
From: Robert Yang @ 2014-01-13 8:19 UTC (permalink / raw)
To: bitbake-devel
The following changes since commit 6ee5d95317de77c1cfb6db6f1ab2de77f5fa085e:
bitbake: fetch2/gitannex: Fix function arguments to match bitbake master (2014-01-08 15:27:37 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib rbt/pv
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/pv
Robert Yang (1):
bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
bitbake/lib/bb/data.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
2014-01-13 8:19 [PATCH 0/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION Robert Yang
@ 2014-01-13 8:19 ` Robert Yang
2014-01-13 11:15 ` Gary Thomas
2014-01-13 23:07 ` Richard Purdie
0 siblings, 2 replies; 7+ messages in thread
From: Robert Yang @ 2014-01-13 8:19 UTC (permalink / raw)
To: bitbake-devel
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(-)
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
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
1 sibling, 1 reply; 7+ messages in thread
From: Gary Thomas @ 2014-01-13 11:15 UTC (permalink / raw)
To: bitbake-devel
On 2014-01-13 01:19, 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(-)
>
> 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:
>
Are you sure this is correct for the 's in exportlist' case?
Perhaps the change should look like this (which is also easier to read):
@@ -175,6 +175,8 @@ def inheritFromOS(d, savedenv, permitted):
for s in savedenv.keys():
if s in permitted:
try:
+ if preferred_version_re.match(s):
+ s = s.replace('__', '-')
d.setVar(s, getVar(s, savedenv, True), op = 'from env')
if s in exportlist:
d.setVarFlag(s, "export", True, op = 'auto env export')
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
2014-01-13 8:19 ` [PATCH 1/1] " Robert Yang
2014-01-13 11:15 ` Gary Thomas
@ 2014-01-13 23:07 ` Richard Purdie
2014-01-14 1:45 ` Robert Yang
2014-01-14 2:38 ` Robert Yang
1 sibling, 2 replies; 7+ messages in thread
From: Richard Purdie @ 2014-01-13 23:07 UTC (permalink / raw)
To: Robert Yang; +Cc: bitbake-devel
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:
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
2014-01-13 11:15 ` Gary Thomas
@ 2014-01-14 1:44 ` Robert Yang
0 siblings, 0 replies; 7+ messages in thread
From: Robert Yang @ 2014-01-14 1:44 UTC (permalink / raw)
To: Gary Thomas, bitbake-devel
On 01/13/2014 07:15 PM, Gary Thomas wrote:
> On 2014-01-13 01:19, 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(-)
>>
>> 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:
>>
>
> Are you sure this is correct for the 's in exportlist' case?
>
Yes, I think so, the exportlist contains constant:
['BB_TASKHASH', 'HOME', 'LOGNAME', 'PATH', 'PWD', 'SHELL', 'TERM', 'USER']
So we don't have to worry about it.
> Perhaps the change should look like this (which is also easier to read):
> @@ -175,6 +175,8 @@ def inheritFromOS(d, savedenv, permitted):
> for s in savedenv.keys():
> if s in permitted:
> try:
> + if preferred_version_re.match(s):
> + s = s.replace('__', '-')
> d.setVar(s, getVar(s, savedenv, True), op = 'from env')
We must need the s_new (or s_to) here, because:
d.setVar(s_to, getVar(s_from, savedenv, True), xxx)
the s_to and s_from are different.
// Robert
> if s in exportlist:
> d.setVarFlag(s, "export", True, op = 'auto env export')
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
2014-01-13 23:07 ` Richard Purdie
@ 2014-01-14 1:45 ` Robert Yang
2014-01-14 2:38 ` Robert Yang
1 sibling, 0 replies; 7+ messages in thread
From: Robert Yang @ 2014-01-14 1:45 UTC (permalink / raw)
To: Richard Purdie; +Cc: bitbake-devel
On 01/14/2014 07:07 AM, Richard Purdie wrote:
> 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?
>
Sounds good, I will send a V2.
// Robert
> 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:
>
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] bitbake: data.py: convert "__" to "-" for PREFERRED_VERSION
2014-01-13 23:07 ` Richard Purdie
2014-01-14 1:45 ` Robert Yang
@ 2014-01-14 2:38 ` Robert Yang
1 sibling, 0 replies; 7+ messages in thread
From: Robert Yang @ 2014-01-14 2:38 UTC (permalink / raw)
To: Richard Purdie; +Cc: bitbake-devel
I've update the PULL, changes:
1) Not only for the PREFERRED_VERSION, but for all env vars.
2) Also take care of the exportlist, though we don't have to care
about it currently, but maybe in the future.
git://git.pokylinux.org/poky-contrib rbt/pv
// Robert
On 01/14/2014 07:07 AM, Richard Purdie wrote:
> 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:
>
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-01-14 2:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-01-14 1:45 ` Robert Yang
2014-01-14 2:38 ` Robert Yang
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.