aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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:35:10 +0100
commit30eaef7f50fff855cf8830772a7088dd83a4240e (patch)
tree70d67893cbf9e53894a5d9921cb39099a3e6a189 /lib
parent85c5b8b3b9c805883537900a46eddb2301ee93f9 (diff)
downloadbitbake-30eaef7f50fff855cf8830772a7088dd83a4240e.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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/parse/parse_py/BBHandler.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index 31d1e21c6..851a7e669 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -193,17 +193,25 @@ def feeder(lineno, s, fn, root, statements):
if lineno == IN_PYTHON_EOF:
return
-# fall through
+ if s and s[0] == '#':
+ if len(__residue__) != 0 and __residue__[0][0] != "#":
+ 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))
- if s == '' or s[0] == '#': return # skip comments and empty lines
-
- if s[-1] == '\\':
+ if s and s[-1] == '\\':
__residue__.append(s[:-1])
return
s = "".join(__residue__) + s
__residue__ = []
+ # Skip empty lines
+ if s == '':
+ return
+
+ # Skip comments
+ if s[0] == '#':
+ return
+
m = __func_start_regexp__.match(s)
if m:
__infunc__ = m.group("func") or "__anonymous"