Patchwork [bitbake-devel] data_smart.py: Rename variable flags

login
register
mail settings
Submitter Otavio Salvador
Date March 20, 2013, 5:59 p.m.
Message ID <1363802396-12282-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/46571/
State New
Headers show

Comments

Otavio Salvador - March 20, 2013, 5:58 p.m.
On Wed, Mar 20, 2013 at 2:59 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> The variable expansion needs to handle variable flags as well
> otherwise those do not behave as expected. One example of this is:
>
> ,----
> | ALTERNATIVE_TARGET_${PN}-foo[name] = "value"
> `----
>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

I think this does not work for all cases but I don't know how to deal
properly with it. It fixes the case of updates-alternative but breaks
other code.

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Otavio Salvador - March 20, 2013, 5:59 p.m.
The variable expansion needs to handle variable flags as well
otherwise those do not behave as expected. One example of this is:

,----
| ALTERNATIVE_TARGET_${PN}-foo[name] = "value"
`----

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 bitbake/lib/bb/data_smart.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Patch

diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 5bf11e5..2e43a8e 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -515,13 +515,17 @@  class DataSmart(MutableMapping):
             self.varhistory.record(**loginfo)
             self.setVar(newkey, val, ignore=True)
 
-        for i in ('_append', '_prepend'):
+        for i in (self.getVarFlags(key) or {}).keys():
             src = self.getVarFlag(key, i)
             if src is None:
                 continue
 
-            dest = self.getVarFlag(newkey, i) or []
-            dest.extend(src)
+            if i in ('_append', '_prepend'):
+                dest = self.getVarFlag(newkey, i) or []
+            else:
+                dest = self.getVarFlag(newkey, i) or ''
+            dest += src
+
             self.setVarFlag(newkey, i, dest, ignore=True)
 
             if i in self._special_values and key in self._special_values[i]: