* Re: [OE-core] [PATCH 1/2] license.bbclass: Improve parsing time when INCOMPATIBLE_LICENSES is big
[not found] <166B7A1BE6E395FA.480@lists.openembedded.org>
@ 2021-03-12 3:21 ` Peter Kjellerstedt
0 siblings, 0 replies; only message in thread
From: Peter Kjellerstedt @ 2021-03-12 3:21 UTC (permalink / raw)
To: openembedded-core
Sorry, wrong list.
//Peter
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Peter Kjellerstedt
> Sent: den 12 mars 2021 04:19
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 1/2] 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.
>
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
> meta/classes/license.bbclass | 9 ++++-----
> 1 file 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):
> """
> 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:
^ permalink raw reply [flat|nested] only message in thread