summaryrefslogtreecommitdiffstats
path: root/lib/bb/data.py
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2011-01-07 14:17:10 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-07 11:14:57 +0000
commit01c4bffcd918b74f4c61405cca3b42a3b104cd35 (patch)
tree47398cb07be87a364d01ff73bad3f40f0f28b048 /lib/bb/data.py
parentbee33a9623c763eb11e8009ffa76869861a9d4a7 (diff)
downloadbitbake-01c4bffcd918b74f4c61405cca3b42a3b104cd35.tar.gz
bitbake/data.py: corrected the output for shell syntax.
[BUGID# 645], modify the emit_var() 1. Added "#" to the beginning of each line if the comment contains multiple lines. 2. Added "\" to the end of each line if the shell variable value contains multiple lines. (From Poky rev: 6f454c10bcdd5) Signed-off-by: Lianhao Lu <lianhao.lu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data.py')
-rw-r--r--lib/bb/data.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py
index 8ecf5bdea..ef60c2868 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -189,7 +189,8 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
return 0
if all:
- o.write('# %s=%s\n' % (var, oval))
+ commentVal = re.sub('\n', '\n#', str(oval))
+ o.write('# %s=%s\n' % (var, commentVal))
if (var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1) and not all:
return 0
@@ -216,6 +217,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
# 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.strip())
+ alter = re.sub('\n', ' \\\n', alter)
o.write('%s="%s"\n' % (varExpanded, alter))
return 0