From 73dc22b728dde0fb76092790ff0fcbb6b326a42d Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 14 Dec 2012 13:53:32 +0000 Subject: bitbake: bitbake: BBHandler/ConfHandler: Improve multiline comment handling Faced with an expression like: # Some comment \ FOO = "bar" what should bitbake do? Technically, the \ character means its multiline and currently the code treats this as a continuation of the comment. This can surprise some people and is not intuitive. This patch makes bitbake simply error and asks the user to be clearer about what they mean. (Bitbake rev: 589d31ce41e019ee6a7cb6527d67bc76c0b6382a) (Bitbake rev: 79c00fabe08b4c210a3bd81cfaffbc47ffdc2e2b) Signed-off-by: Richard Purdie --- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py') diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index dbc6776c89..9b09c9f56a 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -98,15 +98,22 @@ def handle(fn, data, include): while True: lineno = lineno + 1 s = f.readline() - if not s: break + if not s: + break w = s.strip() - if not w: continue # skip empty lines + # skip empty lines + if not w: + continue s = s.rstrip() - if s[0] == '#': continue # skip comments while s[-1] == '\\': s2 = f.readline().strip() lineno = lineno + 1 + if s2 and s[0] == "#" and s2[0] != "#": + bb.fatal("There is a confusing multiline, partially commented expression on line %s of file %s (%s).\nPlease clarify whether this is all a comment or should be parsed." % (lineno, fn, s)) s = s[:-1] + s2 + # skip comments + if s[0] == '#': + continue feeder(lineno, s, fn, statements) # DONE WITH PARSING... time to evaluate -- cgit v1.2.3-54-g00ecf