summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_py/ConfHandler.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-14 13:53:32 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-21 10:55:45 +0000
commit73dc22b728dde0fb76092790ff0fcbb6b326a42d (patch)
tree979432b5421afce07ce520675fa2188beb3e2545 /bitbake/lib/bb/parse/parse_py/ConfHandler.py
parentbac53df5e53ebe26cf2d267a30ab1bbdccd3b541 (diff)
downloadpoky-73dc22b728dde0fb76092790ff0fcbb6b326a42d.tar.gz
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py13
1 files changed, 10 insertions, 3 deletions
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):
98 while True: 98 while True:
99 lineno = lineno + 1 99 lineno = lineno + 1
100 s = f.readline() 100 s = f.readline()
101 if not s: break 101 if not s:
102 break
102 w = s.strip() 103 w = s.strip()
103 if not w: continue # skip empty lines 104 # skip empty lines
105 if not w:
106 continue
104 s = s.rstrip() 107 s = s.rstrip()
105 if s[0] == '#': continue # skip comments
106 while s[-1] == '\\': 108 while s[-1] == '\\':
107 s2 = f.readline().strip() 109 s2 = f.readline().strip()
108 lineno = lineno + 1 110 lineno = lineno + 1
111 if s2 and s[0] == "#" and s2[0] != "#":
112 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))
109 s = s[:-1] + s2 113 s = s[:-1] + s2
114 # skip comments
115 if s[0] == '#':
116 continue
110 feeder(lineno, s, fn, statements) 117 feeder(lineno, s, fn, statements)
111 118
112 # DONE WITH PARSING... time to evaluate 119 # DONE WITH PARSING... time to evaluate