license.bbclass: Improve parsing time when INCOMPATIBLE_LICENSES is big
A message that is not in the archive (sent off-list or not yet received): [email protected]
Sorry, wrong list.
//Peter
Quoted 47 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 12 mars 2021 04:19
To: [email protected]
Subject: [OE-core] [PATCH 1/2] license.bbclass: Improve parsing time whenINCOMPATIBLE_LICENSESis bigThe commit
08cbf1748(licenses: UpdateINCOMPATIBLE_LICENSEfor 'or-later' handling) increased the parsing time considerably if there are many licenses inINCOMPATIBLE_LICENSE. Reorganize the code to get almost all the time back.Signed-off-by Peter Kjellerstedt <[email protected]>--- meta/classes/license.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)meta/classes/license.bbclass +0
-1@@ -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 aswell
meta/classes/license.bbclass +0
-4- 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 inspdxflags]
+ # Assume if we're passed "GPLv3" or "*GPLv3" it means -or-later
as wellmeta/classes/license.bbclass +3
-0+ if not wld_lic.endswith(("-or-later", "-only", "*", "+")): + spdxflags = fnmatch.filter(spdxmapkeys, wld_lic + "+") + licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag inspdxflags]
spdx_lics= d.getVar('AVAILABLE_LICENSES').split() forwld_licinwildcard_licenses: