From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: RE: [OE-core] [PATCH 1/2] create-spdx: Use function rather than AVAILABLE_LICENSES
Date: Tue, 15 Mar 2022 17:48:12 +0000 [thread overview]
Message-ID: <f39762f2fc464c619aa3035abd66321e@axis.com> (raw)
In-Reply-To: <20220315173310.889973-1-richard.purdie@linuxfoundation.org>
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 15 mars 2022 18:33
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 1/2] create-spdx: Use function rather than AVAILABLE_LICENSES
>
> We can directly call the function rather than using the variable
> indirection.
> As this is the last user of the variable, it then allows removal of it in a
> followup patch.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> meta/classes/create-spdx.bbclass | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
> index daf99ca676c..1a4804a7c50 100644
> --- a/meta/classes/create-spdx.bbclass
> +++ b/meta/classes/create-spdx.bbclass
> @@ -94,7 +94,7 @@ def convert_license_to_spdx(lic, document, d, existing={}):
> from pathlib import Path
> import oe.spdx
>
> - available_licenses = d.getVar("AVAILABLE_LICENSES").split()
> + avail_licenses = available_licenses(d)
Doesn't this mean that the available licenses will be calculated once
per recipe? Or isn't it a problem since the time will not be spent
during recipe parsing, but rather during task execution where no one
will notice if the create-spdx task for all recipes takes a little
longer?
That said, if I remember correctly from the last time I looked at this
function, it should be possible to rewrite it to not rely on
available_licenses() without any real loss in functionality.
> license_data = d.getVar("SPDX_LICENSE_DATA")
> extracted = {}
>
> @@ -112,7 +112,7 @@ def convert_license_to_spdx(lic, document, d, existing={}):
> if name == "PD":
> # Special-case this.
> extracted_info.extractedText = "Software released to the public domain"
> - elif name in available_licenses:
> + elif name in avail_licenses:
> # This license can be found in COMMON_LICENSE_DIR or LICENSE_PATH
> for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split():
> try:
> @@ -122,11 +122,11 @@ def convert_license_to_spdx(lic, document, d, existing={}):
> except FileNotFoundError:
> pass
> if extracted_info.extractedText is None:
> - # Error out, as the license was in available_licenses so should
> + # Error out, as the license was in avail_licenses so should
> # be on disk somewhere.
> bb.error("Cannot find text for license %s" % name)
> else:
> - # If it's not SPDX, or PD, or in available licenses, then NO_GENERIC_LICENSE must be set
> + # If it's not SPDX, or PD, or in avail_licenses, then NO_GENERIC_LICENSE must be set
> filename = d.getVarFlag('NO_GENERIC_LICENSE', name)
> if filename:
> filename = d.expand("${S}/" + filename)
> --
> 2.32.0
//Peter
next prev parent reply other threads:[~2022-03-15 17:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 17:33 [PATCH 1/2] create-spdx: Use function rather than AVAILABLE_LICENSES Richard Purdie
2022-03-15 17:33 ` [PATCH 2/2] sstate: Allow optimisation of do_create_spdx task dependencies Richard Purdie
2022-03-15 17:48 ` Peter Kjellerstedt [this message]
2022-03-15 17:58 ` [OE-core] [PATCH 1/2] create-spdx: Use function rather than AVAILABLE_LICENSES Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f39762f2fc464c619aa3035abd66321e@axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.