From 64327ba9ea1d1cefab1bc35d456da68bc061dcf5 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 30 Aug 2011 16:46:46 +0000 Subject: 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 --- bitbake/lib/bb/parse/parse_py/BBHandler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bitbake/lib/bb/parse') 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): return - # Skip empty lines - if s == '': - return - - if s[0] == '#': + 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[-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 -- cgit v1.2.3-54-g00ecf