All of lore.kernel.org
 help / color / mirror / Atom feed
* bitbake/parse: Correctly handle multiline comments including whitespace
@ 2011-08-30 16:50 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2011-08-30 16:50 UTC (permalink / raw)
  To: bitbake-devel

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]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 402cd07..c59b468 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





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-30 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30 16:50 bitbake/parse: Correctly handle multiline comments including whitespace Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.