Skip to contentSkip to conversation

data.py: sort exported variables

PATCH In review Juro Bystricky 2 participants 2 messages Mar 17, 2017 – Mar 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data.py: sort exported variables

Various run.do_xxx files export dozens of variables. Presently they are in random order. Among other things, this makes it difficult to compare two files for relevant changes. This patch ensures they are enumerated/printed in a sorted (alphabetical) order.

---
 bitbake/lib/bb/data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/data.py +1 -1
index 0f05b60..d145f1b 100644
@@ -220,7 +220,7 @@ def emit_func(func, o=sys.__stdout__, d = init()):
     """Emits all items in the data store in a format such that it can be sourced by a shell."""
 
     keys = (key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func", False))
-    for key in keys:
+    for key in sorted(keys):
         emit_var(key, o, d, False)
 
     o.write('\n')
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Juro Bystricky

Various run.do_xxx files export dozens of variables. Presently they are in random order. Among other things, this makes it difficult to compare two files for relevant changes. This patch ensures they are enumerated/printed in a sorted (alphabetical) order.

+1

My version from last year (which also separated out variables being unset):

http://lists.openembedded.org/pipermail/bitbake-devel/2016-January/006970.html

was never merged, so hopefully this one fares better.

Quoted 26 lines
---
 bitbake/lib/bb/data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/data.py +1 -2
index 0f05b60..d145f1b 100644
@@ -220,7 +220,7 @@ def emit_func(func, o=sys.__stdout__, d = init()):
     """Emits all items in the data store in a format such that it can be sourced by a shell."""
 
     keys = (key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func", False))
-    for key in keys:
+    for key in sorted(keys):
         emit_var(key, o, d, False)
 
     o.write('\n')
--

2.7.4

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel