Fix find_bbfiles when BBFILES contains directory
PATCH 1/1 Fix find_bbfiles when BBFILES contains directory
When BBFILES in layer.conf contains a directory, this triggers find_bbfiles function which will fail on endswith that does not expect a list.
--- bitbake/lib/bb/cooker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/cooker.py +1 -1
@@ -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
Signature · 1 line
2.25.1
Hi Talel,
Quoted 2 lines · BELHADJ SALEM Talel via lists.openembedded.org
When BBFILES in layer.conf contains a directory, this triggers
find_bbfilesfunction
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?
Quoted 12 lines
which will fail on endswith that does not expect a list.
Signed-off-by Talel BELHAJSALEM <[email protected]>--- bitbake/lib/bb/cooker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/cooker.py +0
-0
bitbake/lib/bb/cooker.py class CookerCollectFiles(object): · line 1830
Quoted 5 lines
bitbake/lib/bb/cooker.py +1
-1@@ -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
Quoted 41 lines · Quentin Schulz
Hi Talel,
Quoted 2 lines · BELHADJ SALEM Talel via lists.openembedded.org
When BBFILES in layer.conf contains a directory, this triggers
find_bbfilesfunction
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?
Quoted 12 lines
which will fail on endswith that does not expect a list.
Signed-off-by Talel BELHAJSALEM <[email protected]>--- bitbake/lib/bb/cooker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/cooker.py +0
-0bitbake/lib/bb/cooker.py class CookerCollectFiles(object): · line 1830
Quoted 4 lines
bitbake/lib/bb/cooker.py +0
-1@@ -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']))]bitbake/lib/bb/cooker.py class CookerCollectFiles(object): · line 1830
Quoted 1 line
bitbake/lib/bb/cooker.py +1
-0+ 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.
Signature · 1 line
Pavel
Quoted 48 lines · Quentin Schulz via lists.openembedded.org
Hi Talel,
Quoted 2 lines · BELHADJ SALEM Talel via lists.openembedded.org
When BBFILES in layer.conf contains a directory, this triggers
find_bbfilesfunction1) 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?
Quoted 12 lines
which will fail on endswith that does not expect a list.
Signed-off-by Talel BELHAJSALEM <[email protected]>--- bitbake/lib/bb/cooker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/cooker.py +0
-0bitbake/lib/bb/cooker.py class CookerCollectFiles(object): · line 1830
Quoted 5 lines
bitbake/lib/bb/cooker.py +1
-1@@ -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: [email protected] <mailto:bitbake-devel%[email protected]>
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
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
Quoted 63 lines · Pavel Zhukov
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,
Quoted 2 lines · BELHADJ SALEM Talel via lists.openembedded.org
When BBFILES in layer.conf contains a directory, this triggers
find_bbfilesfunction
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?
Quoted 12 lines
which will fail on endswith that does not expect a list.
Signed-off-by Talel BELHAJSALEM <[email protected]>--- bitbake/lib/bb/cooker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bitbake/lib/bb/cooker.py +0
-0bitbake/lib/bb/cooker.py class CookerCollectFiles(object): · line 1830
Quoted 4 lines
bitbake/lib/bb/cooker.py +0
-1@@ -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']))]bitbake/lib/bb/cooker.py class CookerCollectFiles(object): · line 1830
Quoted 1 line
bitbake/lib/bb/cooker.py +1
-0+ 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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-