[bitbake-devel] [PATCH 3/3] data.py: sort variables being output by emit_func()

Andre McCurdy armccurdy at gmail.com
Thu Jan 28 00:43:18 UTC 2016


Sorting variables and separating those being exported from those being
unset greatly improves the readability of OE run.do_configure, etc,
shell scripts.

Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
---
 lib/bb/data.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/bb/data.py b/lib/bb/data.py
index 70ba56b..07f4bba 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -270,7 +270,13 @@ def exported_vars(d):
 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"))
+    o.write('\n')
+    keys = sorted(key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func") and not d.getVarFlag(key, 'unexport'))
+    for key in keys:
+        emit_var(key, o, d, False)
+
+    o.write('\n')
+    keys = sorted(key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func") and d.getVarFlag(key, 'unexport'))
     for key in keys:
         emit_var(key, o, d, False)
 
-- 
1.9.1




More information about the bitbake-devel mailing list