diff mbox series

[5/5] parse: Make include_all support absolute paths

Message ID 20250916000648.1182372-5-pkj@axis.com
State New
Headers show
Series [1/5] tests/parse: Use with statement to avoid ResourceWarning | expand

Commit Message

Peter Kjellerstedt Sept. 16, 2025, 12:06 a.m. UTC
While it does not make much sense to use an absolute path with
include_all, if one is used, it should only be included once, rather
than once per path in BBPATH.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/lib/bb/parse/parse_py/ConfHandler.py | 2 +-
 bitbake/lib/bb/tests/parse.py                | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Purdie Sept. 16, 2025, 11:13 a.m. UTC | #1
On Tue, 2025-09-16 at 02:06 +0200, Peter Kjellerstedt via lists.openembedded.org wrote:
> While it does not make much sense to use an absolute path with
> include_all, if one is used, it should only be included once, rather
> than once per path in BBPATH.
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  bitbake/lib/bb/parse/parse_py/ConfHandler.py | 2 +-
>  bitbake/lib/bb/tests/parse.py                | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)

I think I'd prefer this to error to be honest as it doesn't make sense.

Cheers,

Richard
diff mbox series

Patch

diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index af3af2ccee..caf526044c 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -67,7 +67,7 @@  def include(parentfn, fns, lineno, data, error_out, all=False):
 
     # "include" or "require" accept zero to n space-separated file names to include.
     for fn in fns.split():
-        if all:
+        if all and not os.path.isabs(fn):
             for path in data.getVar("BBPATH").split(":"):
                 include_single_file(parentfn, os.path.join(path, fn), lineno, data, error_out)
         else:
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py
index 2f77c90f60..b4033f8cfd 100644
--- a/bitbake/lib/bb/tests/parse.py
+++ b/bitbake/lib/bb/tests/parse.py
@@ -500,6 +500,7 @@  EXTRA_OECONF:append = " foobar"
             test_helper("include_all someother.conf", None)
             test_helper("include_all some3.conf", " foobar")
             test_helper("include_all ${@''}", None)
+            test_helper("include_all " + tempdir + "/conf2/some.conf", " bar")
 
             self.d.setVar("BBPATH", tempdir + "/conf2" + ":" + tempdir + "/conf1")