Skip to contentSkip to conversation

data: show value in -e when unexported

PATCH New Ross Burton 1 participant 1 message Mar 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data: show value in -e when unexported

When a value has been unexported it still has a value, so write it out in a comment to keep the output shell-like.

---
 bitbake/lib/bb/data.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
bitbake/lib/bb/data.py +8 -8
index 80a7879cb66..62fef18c40d 100644
@@ -156,10 +156,6 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
 
     varExpanded = d.expand(var)
 
-    if unexport:
-        o.write('unset %s\n' % varExpanded)
-        return False
-
     if val is None:
         return False
 
@@ -178,15 +174,19 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
         o.write("%s() {\n%s\n}\n" % (varExpanded, val))
         return 1
 
-    if export:
-        o.write('export ')
-
     # if we're going to output this within doublequotes,
     # to a shell, we need to escape the quotes in the var
     alter = re.sub('"', '\\"', val)
     alter = re.sub('\n', ' \\\n', alter)
     alter = re.sub('\\$', '\\\\$', alter)
-    o.write('%s="%s"\n' % (varExpanded, alter))
+
+    if unexport:
+        o.write('unset %s # "%s"\n' % (varExpanded, alter))
+    elif export:
+        o.write('export %s="%s"\n' % (varExpanded, alter))
+    else:
+        o.write('%s="%s"\n' % (varExpanded, alter))
+
     return False
 
 def emit_env(o=sys.__stdout__, d = init(), all=False):
Signature · 1 line
2.11.0