summaryrefslogtreecommitdiff
path: root/bitbake
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:22 +0000
commit6f454c10bcdd5245ea9297f5334fc56ac06dbdb9 (patch)
tree52770e111ecd43a1194e1315fe2bb2468a93c5b0 /bitbake
parentdc10e1688e9aa3b6f06b2a37b1d5bdb63443b955 (diff)
downloadopenembedded-core-6f454c10bcdd5245ea9297f5334fc56ac06dbdb9.tar.gz
openembedded-core-6f454c10bcdd5245ea9297f5334fc56ac06dbdb9.tar.bz2
openembedded-core-6f454c10bcdd5245ea9297f5334fc56ac06dbdb9.tar.xz
openembedded-core-6f454c10bcdd5245ea9297f5334fc56ac06dbdb9.zip
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. Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/data.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 6ec522aa4..53ce7d62d 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -192,7 +192,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
@@ -219,6 +220,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