Message ID | 20231009145918.900167-1-bhstalel@gmail.com |
---|---|
State | New |
Headers | show |
Series | Fix find_bbfiles when BBFILES contains directory | expand |
Hi Talel, On 10/9/23 16:59, BELHADJ SALEM Talel via lists.openembedded.org wrote: > > When BBFILES in layer.conf contains a directory, this triggers find_bbfiles function 1) BBFILES docs clearly specifies: A space-separated list of recipe files BitBake uses to build software. So I would say that giving it a directory is incorrect. If it is supposed to be supported, then we need to fix the documentation. What are you trying to do? > which will fail on endswith that does not expect a list. > > Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> > --- > bitbake/lib/bb/cooker.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py > index 2adf4d297d..a354f2f0ab 100644 > --- a/bitbake/lib/bb/cooker.py > +++ b/bitbake/lib/bb/cooker.py > @@ -1827,7 +1827,7 @@ class CookerCollectFiles(object): > for ignored in ('SCCS', 'CVS', '.svn'): > if ignored in dirs: > dirs.remove(ignored) > - found += [os.path.join(dir, f) for f in files if (f.endswith(['.bb', '.bbappend']))] > + found += [os.path.join(dir, f) for f in files if (f.endswith(tuple(['.bb', '.bbappend'])))] 2) Just replace the square brackets with parenthesis instead to save an unnecessary array creation. Cheers, Quentin
Hi Quentin, I am stress testing and analysing the source code to see how Bitbake behaves on different cases of layer.conf content. I am doing this to get familiar with the large code base quickly. I found `find_bbfiles` which clearly intended to find .bb files in a layer if no BBFILE_PATTERN is provided. I also noted this behavior: 1. When layer.conf is empty, it gets added to bblayers.conf but show-layers will not show it (Logic as there is no BBFILE_COLLECTION) but why add it in the first place ? 2. When only BBFILES is provided, bitbake will find the recipe, also will find the .bbclass even if the doc says that it needs BBPATH to find conf and classes ? 3. This leads me to find_bbfiles, if BBFILES should not contain directories, I think this should be checked when adding the layer, or something like that. Is this all normal behavior ? Or am I missing something? What do you think? Kind regards Talel On Mon, Oct 9, 2023 at 4:16 PM Quentin Schulz < quentin.schulz@theobroma-systems.com> wrote: > Hi Talel, > > On 10/9/23 16:59, BELHADJ SALEM Talel via lists.openembedded.org wrote: > > > > When BBFILES in layer.conf contains a directory, this triggers > find_bbfiles function > 1) BBFILES docs clearly specifies: > > A space-separated list of recipe files BitBake uses to build software. > > So I would say that giving it a directory is incorrect. If it is > supposed to be supported, then we need to fix the documentation. > > What are you trying to do? > > > which will fail on endswith that does not expect a list. > > > > Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> > > --- > > bitbake/lib/bb/cooker.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py > > index 2adf4d297d..a354f2f0ab 100644 > > --- a/bitbake/lib/bb/cooker.py > > +++ b/bitbake/lib/bb/cooker.py > > @@ -1827,7 +1827,7 @@ class CookerCollectFiles(object): > > for ignored in ('SCCS', 'CVS', '.svn'): > > if ignored in dirs: > > dirs.remove(ignored) > > - found += [os.path.join(dir, f) for f in files if > (f.endswith(['.bb', '.bbappend']))] > > + found += [os.path.join(dir, f) for f in files if > (f.endswith(tuple(['.bb', '.bbappend'])))] > > 2) Just replace the square brackets with parenthesis instead to save an > unnecessary array creation. > > Cheers, > Quentin >
Looks like documentation doesn't support this but the code does... Simple test case can be useful.
Should I provide a test case (sample layer?) for this? Or should I try to add the support to the documentation according to the source code? Thanks. Talel On Mon, Oct 9, 2023 at 6:23 PM Pavel Zhukov <pavel@zhukoff.net> wrote: > Looks like documentation doesn't support this but the code does... > Simple test case can be useful. > > -- > Pavel > On Mon, Oct 9, 2023, at 17:16, Quentin Schulz via lists.openembedded.org > wrote: > > Hi Talel, > > On 10/9/23 16:59, BELHADJ SALEM Talel via lists.openembedded.org wrote: > > > > When BBFILES in layer.conf contains a directory, this triggers > find_bbfiles function > 1) BBFILES docs clearly specifies: > > A space-separated list of recipe files BitBake uses to build software. > > So I would say that giving it a directory is incorrect. If it is > supposed to be supported, then we need to fix the documentation. > > What are you trying to do? > > > which will fail on endswith that does not expect a list. > > > > Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> > > --- > > bitbake/lib/bb/cooker.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py > > index 2adf4d297d..a354f2f0ab 100644 > > --- a/bitbake/lib/bb/cooker.py > > +++ b/bitbake/lib/bb/cooker.py > > @@ -1827,7 +1827,7 @@ class CookerCollectFiles(object): > > for ignored in ('SCCS', 'CVS', '.svn'): > > if ignored in dirs: > > dirs.remove(ignored) > > - found += [os.path.join(dir, f) for f in files if > (f.endswith(['.bb', '.bbappend']))] > > + found += [os.path.join(dir, f) for f in files if > (f.endswith(tuple(['.bb', '.bbappend'])))] > > 2) Just replace the square brackets with parenthesis instead to save an > unnecessary array creation. > > Cheers, > Quentin > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#15195): > https://lists.openembedded.org/g/bitbake-devel/message/15195 > Mute This Topic: https://lists.openembedded.org/mt/101854064/6390638 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > pavel@zhukoff.net] > -=-=-=-=-=-=-=-=-=-=-=- > > > >
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 2adf4d297d..a354f2f0ab 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -1827,7 +1827,7 @@ class CookerCollectFiles(object): for ignored in ('SCCS', 'CVS', '.svn'): if ignored in dirs: dirs.remove(ignored) - found += [os.path.join(dir, f) for f in files if (f.endswith(['.bb', '.bbappend']))] + found += [os.path.join(dir, f) for f in files if (f.endswith(tuple(['.bb', '.bbappend'])))] return found
When BBFILES in layer.conf contains a directory, this triggers find_bbfiles function which will fail on endswith that does not expect a list. Signed-off-by: Talel BELHAJSALEM <bhstalel@gmail.com> --- bitbake/lib/bb/cooker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)