aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2020-09-09 04:55:19 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-09 23:40:07 +0100
commit8d64181d29dc262e066a6114dd51e5f2d04f47de (patch)
tree2d9ed54e9278f2870ad2db759d69aa2ce11ff356
parent49bdb5dfa57b41b3ed399961e947c404f9195998 (diff)
downloadbitbake-8d64181d29dc262e066a6114dd51e5f2d04f47de.tar.gz
utils.py: get_file_layer(): Exit the loop when file is matched
This can make "$ bitbake-layers show-recipes" save about 60% time (14min -> 6min) in my build (more than 3000 recipes) The command "bitbake-layers show-recipes" calls bb.utils.get_file_layer() with each recipe, and get_file_layer() compare the file with each item in BBFILES which makes it very time consuming when there are a lot of recipes and items in BBFILES. So use BBFILES_PRIORITIZED and exit when file is matched, it doesn't make sense to go on the loop when file is matched. And use fnmatchcase to replace of fnmatch since the comparison should be case-sensitive. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 2d4b258b8..b7e2c9218 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1476,12 +1476,13 @@ def get_file_layer(filename, d):
return match
result = None
- bbfiles = (d.getVar('BBFILES') or '').split()
+ bbfiles = (d.getVar('BBFILES_PRIORITIZED') or '').split()
bbfilesmatch = False
for bbfilesentry in bbfiles:
- if fnmatch.fnmatch(filename, bbfilesentry):
+ if fnmatch.fnmatchcase(filename, bbfilesentry):
bbfilesmatch = True
result = path_to_layer(bbfilesentry)
+ break
if not bbfilesmatch:
# Probably a bbclass