From 28648ee17f48421a4e94fdccbaf6960e0b8d78a1 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Fri, 12 Mar 2021 04:18:52 +0100 Subject: 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 Signed-off-by: Richard Purdie --- meta/classes/license.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'meta/classes/license.bbclass') 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): """ import fnmatch - # Assume if we're passed "GPLv3" or "*GPLv3" it means -or-later as well - for lic in wildcard_licenses[:]: - if not lic.endswith(("-or-later", "-only", "*")): - wildcard_licenses.append(lic + "+") - licenses = wildcard_licenses[:] spdxmapkeys = d.getVarFlags('SPDXLICENSEMAP').keys() for wld_lic in wildcard_licenses: spdxflags = fnmatch.filter(spdxmapkeys, wld_lic) licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags] + # Assume if we're passed "GPLv3" or "*GPLv3" it means -or-later as well + if not wld_lic.endswith(("-or-later", "-only", "*", "+")): + spdxflags = fnmatch.filter(spdxmapkeys, wld_lic + "+") + licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags] spdx_lics = d.getVar('AVAILABLE_LICENSES').split() for wld_lic in wildcard_licenses: -- cgit v1.2.3-54-g00ecf