All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] BBHandler: Don't classify shell functions that names start with "python*" as python function
@ 2021-02-06 20:42 Tomasz Dziendzielski
  0 siblings, 0 replies; only message in thread
From: Tomasz Dziendzielski @ 2021-02-06 20:42 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Tomasz Dziendzielski

If shell function name starts with 'python' or 'fakeroot' parser wrongly
assumes it's python/fakeroot function.

[YOCTO #14204]

Use regex lookahead assertions to check if 'python' expression is
followed by whitespace or '(' and if 'fakeroot' is followed by
whitespace.

Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
---
 lib/bb/parse/parse_py/BBHandler.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index 8a520e30..7fc16299 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -22,7 +22,7 @@ from .ConfHandler import include, init
 # For compatibility
 bb.deprecate_import(__name__, "bb.parse", ["vars_from_file"])
 
-__func_start_regexp__    = re.compile(r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" )
+__func_start_regexp__    = re.compile(r"(((?P<py>python(?=(\s|\()))|(?P<fr>fakeroot(?=\s)))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" )
 __inherit_regexp__       = re.compile(r"inherit\s+(.+)" )
 __export_func_regexp__   = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" )
 __addtask_regexp__       = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*")
-- 
2.30.0


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

only message in thread, other threads:[~2021-02-06 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-06 20:42 [PATCH] BBHandler: Don't classify shell functions that names start with "python*" as python function Tomasz Dziendzielski

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.