summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-30 16:46:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-31 19:38:22 +0100
commit64327ba9ea1d1cefab1bc35d456da68bc061dcf5 (patch)
tree41e6b8ce6dd6d9e3dfa2d5a92c80e3ac20d58e31
parent8a78ed689daa9a0eab0ff9e0c4d1ac5fc0b520a9 (diff)
downloadpoky-64327ba9ea1d1cefab1bc35d456da68bc061dcf5.tar.gz
bitbake: Correctly handle multiline comments including whitespace
If metadata contains: """ FOO = "bar" """ The variable FOO should get set to "bar" but doesn't due to the empty lines be swallowed by the parser and FOO becomming part of the multiline comment. This patch corrects that behaviour so FOO is set as expected. [YOCTO #1377] This patch fixes parsing of multiline comments so lines ending with \ behave consistently and we warn users where there is something happening they likely don't expect. (Bitbake rev: 30eaef7f50fff855cf8830772a7088dd83a4240e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 402cd07e2a..c59b468e0b 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -194,21 +194,21 @@ def feeder(lineno, s, fn, root, statements):
194 return 194 return
195 195
196 196
197 # Skip empty lines 197 if s and s[0] == '#':
198 if s == '':
199 return
200
201 if s[0] == '#':
202 if len(__residue__) != 0 and __residue__[0][0] != "#": 198 if len(__residue__) != 0 and __residue__[0][0] != "#":
203 bb.error("There is a comment on line %s of file %s (%s) which is in the middle of a multiline expression.\nBitbake used to ignore these but no longer does so, please fix your metadata as errors are likely as a result of this change." % (lineno, fn, s)) 199 bb.error("There is a comment on line %s of file %s (%s) which is in the middle of a multiline expression.\nBitbake used to ignore these but no longer does so, please fix your metadata as errors are likely as a result of this change." % (lineno, fn, s))
204 200
205 if s[-1] == '\\': 201 if s and s[-1] == '\\':
206 __residue__.append(s[:-1]) 202 __residue__.append(s[:-1])
207 return 203 return
208 204
209 s = "".join(__residue__) + s 205 s = "".join(__residue__) + s
210 __residue__ = [] 206 __residue__ = []
211 207
208 # Skip empty lines
209 if s == '':
210 return
211
212 # Skip comments 212 # Skip comments
213 if s[0] == '#': 213 if s[0] == '#':
214 return 214 return