diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2020-09-09 04:55:19 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-10 13:49:21 +0100 |
commit | f543535e3ca4d86bee10801450dc22f3b5382b4c (patch) | |
tree | 8143c785b8bfdb66651e3772638874a97bb44e96 /bitbake/lib | |
parent | a74fb2b3060999392ad083303d377f93d9807c8c (diff) | |
download | poky-f543535e3ca4d86bee10801450dc22f3b5382b4c.tar.gz |
bitbake: 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.
(Bitbake rev: 8d64181d29dc262e066a6114dd51e5f2d04f47de)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 2d4b258b85..b7e2c9218b 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -1476,12 +1476,13 @@ def get_file_layer(filename, d): | |||
1476 | return match | 1476 | return match |
1477 | 1477 | ||
1478 | result = None | 1478 | result = None |
1479 | bbfiles = (d.getVar('BBFILES') or '').split() | 1479 | bbfiles = (d.getVar('BBFILES_PRIORITIZED') or '').split() |
1480 | bbfilesmatch = False | 1480 | bbfilesmatch = False |
1481 | for bbfilesentry in bbfiles: | 1481 | for bbfilesentry in bbfiles: |
1482 | if fnmatch.fnmatch(filename, bbfilesentry): | 1482 | if fnmatch.fnmatchcase(filename, bbfilesentry): |
1483 | bbfilesmatch = True | 1483 | bbfilesmatch = True |
1484 | result = path_to_layer(bbfilesentry) | 1484 | result = path_to_layer(bbfilesentry) |
1485 | break | ||
1485 | 1486 | ||
1486 | if not bbfilesmatch: | 1487 | if not bbfilesmatch: |
1487 | # Probably a bbclass | 1488 | # Probably a bbclass |