diff mbox series

[2/3] BBHandler: Make inherit calls more directly

Message ID 20220810134337.420149-2-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 0f4f3af6d93a0018df58b8a1d8d423c78ba6526d
Headers show
Series [1/3] BBHandler: Allow earlier exit for classes not found | expand

Commit Message

Richard Purdie Aug. 10, 2022, 1:43 p.m. UTC
Rather than recursing into the conf handler code, simply call into
the parse code directly when inheriting files as we've already resolved
the paths and don't need anything the other codepath brings. This
makes the codepath clearer at the expense of some slight duplication.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/parse/parse_py/BBHandler.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index 532a4e08f1..1189114341 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -63,7 +63,10 @@  def inherit(files, fn, lineno, d):
             logger.debug("Inheriting %s (from %s:%d)" % (file, fn, lineno))
             __inherit_cache.append( file )
             d.setVar('__inherit_cache', __inherit_cache)
-            include(fn, file, lineno, d, "inherit")
+            try:
+                bb.parse.handle(file, d, True)
+            except (IOError, OSError) as exc:
+                raise ParseError("Could not inherit file %s: %s" % (fn, exc.strerror), fn, lineno)
             __inherit_cache = d.getVar('__inherit_cache', False) or []
 
 def get_statements(filename, absolute_filename, base_name):