diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2021-03-12 04:18:52 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-14 16:33:59 +0000 |
commit | 28648ee17f48421a4e94fdccbaf6960e0b8d78a1 (patch) | |
tree | 2494525b457e570d96651a9ba1fb53030b73b2bc /meta/classes | |
parent | 9952e546e1c8bcbdb0c8db243829751883816603 (diff) | |
download | poky-28648ee17f48421a4e94fdccbaf6960e0b8d78a1.tar.gz |
license.bbclass: Improve parsing time when INCOMPATIBLE_LICENSES is big
The commit 08cbf1748 (licenses: Update INCOMPATIBLE_LICENSE for
'or-later' handling) increased the parsing time considerably if there
are many licenses in INCOMPATIBLE_LICENSE. Reorganize the code to get
almost all the time back.
(From OE-Core rev: dd2532279fb239e7f61396898a8aa44ee5104d1d)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/license.bbclass | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index bcea0b3cb5..f7978e266b 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -282,16 +282,15 @@ def expand_wildcard_licenses(d, wildcard_licenses): | |||
282 | """ | 282 | """ |
283 | import fnmatch | 283 | import fnmatch |
284 | 284 | ||
285 | # Assume if we're passed "GPLv3" or "*GPLv3" it means -or-later as well | ||
286 | for lic in wildcard_licenses[:]: | ||
287 | if not lic.endswith(("-or-later", "-only", "*")): | ||
288 | wildcard_licenses.append(lic + "+") | ||
289 | |||
290 | licenses = wildcard_licenses[:] | 285 | licenses = wildcard_licenses[:] |
291 | spdxmapkeys = d.getVarFlags('SPDXLICENSEMAP').keys() | 286 | spdxmapkeys = d.getVarFlags('SPDXLICENSEMAP').keys() |
292 | for wld_lic in wildcard_licenses: | 287 | for wld_lic in wildcard_licenses: |
293 | spdxflags = fnmatch.filter(spdxmapkeys, wld_lic) | 288 | spdxflags = fnmatch.filter(spdxmapkeys, wld_lic) |
294 | licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags] | 289 | licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags] |
290 | # Assume if we're passed "GPLv3" or "*GPLv3" it means -or-later as well | ||
291 | if not wld_lic.endswith(("-or-later", "-only", "*", "+")): | ||
292 | spdxflags = fnmatch.filter(spdxmapkeys, wld_lic + "+") | ||
293 | licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags] | ||
295 | 294 | ||
296 | spdx_lics = d.getVar('AVAILABLE_LICENSES').split() | 295 | spdx_lics = d.getVar('AVAILABLE_LICENSES').split() |
297 | for wld_lic in wildcard_licenses: | 296 | for wld_lic in wildcard_licenses: |