All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Peter Kjellerstedt" <peter.kjellerstedt@axis.com>
To: Meh Mbeh Ida Delphine <idadelm@gmail.com>,
	"openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [poky-contrib][PATCH 1/4] oe.license: Add functions to split and canonicalise license strings.
Date: Fri, 12 Mar 2021 15:59:32 +0000	[thread overview]
Message-ID: <c1a2d05c715e4310b939dce81ccc243c@XBOX03.axis.com> (raw)
In-Reply-To: <20210309233130.104839-1-idadelm@gmail.com>

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Meh Mbeh Ida Delphine
> Sent: den 10 mars 2021 00:31
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [poky-contrib][PATCH 1/4] oe.license: Add functions to split and canonicalise license strings.
> 
> These functions ensures recipe LICENSE strings are split into their
> individual licenses and then canonicalised to easily enable their matching
> with licenses of sources during the packaging process.
> 
> Signed-off-by: Ida Delphine <idadelm@gmail.com>
> ---
>  meta/lib/oe/license.py | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
> index 665d32ecbb..9e9957be1d 100644
> --- a/meta/lib/oe/license.py
> +++ b/meta/lib/oe/license.py
> @@ -236,3 +236,26 @@ def list_licenses(licensestr):
>      except SyntaxError as exc:
>          raise LicenseSyntaxError(licensestr, exc)
>      return visitor.licenses
> +
> +def canonical_license(license, d):
> +    """
> +    Return the canonical (SPDX) form of the license if available (so GPLv3
> +    becomes GPL-3.0), for the license named 'X+', return canonical form of
> +    'X' if available and the tailing '+' (so GPLv3+ becomes GPL-3.0+),
> +    or the passed license if there is no canonical form.
> +    """
> +    lic = d.getVarFlag('SPDXLICENSEMAP', license) or ""
> +    if not lic and license.endswith('+'):

Do we really need this if statement now that there are entries for 
all relevant licenses that use '+' in the SPDXLICENSEMAP? Isn't it 
better to rely on the SPDXLICENSEMAP to handle any special cases 
like this than to add code all over the place to support this 
legacy way of marking licenses as "-or-later".

> +        lic = d.getVarFlag('SPDXLICENSEMAP', license.rstrip('+'))
> +        if lic:
> +            lic += '+'
> +    return lic or license
> +
> +def split_spdx_lic(licensestr,d):
> +    """
> +    Split the license strings and returns a set of the
> +    canonicalised licenses.
> +    """
> +    split_lic = list_licenses(licensestr)
> +    spdx_lic = set([canonical_license(l, d) for l in split_lic])
> +    return spdx_lic
> \ No newline at end of file

Please add a newline on the last line.

> --
> 2.25.1

//Peter


      parent reply	other threads:[~2021-03-12 15:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 23:31 [poky-contrib][PATCH 1/4] oe.license: Add functions to split and canonicalise license strings Meh Mbeh Ida Delphine
2021-03-09 23:31 ` [poky-contrib][PATCH 2/4] package.bbclass: Displays warnings for just licences in recipes Meh Mbeh Ida Delphine
2021-03-12 16:57   ` [OE-core] " Peter Kjellerstedt
2021-03-09 23:31 ` [poky-contrib][PATCH 3/4] package.bbclass: Add handle_qa_error check Meh Mbeh Ida Delphine
2021-03-12 16:44   ` [OE-core] " Peter Kjellerstedt
2021-03-12 16:54     ` Christopher Larson
2021-03-12 16:59       ` Richard Purdie
2021-03-12 17:29         ` Meh Mbeh Ida Delphine
2021-03-09 23:31 ` [poky-contrib][PATCH 4/4] Moved logic to get filelics from package.bbclass to license.py Meh Mbeh Ida Delphine
2021-03-12 16:18   ` [OE-core] " Peter Kjellerstedt
2021-03-12 17:38     ` Meh Mbeh Ida Delphine
2021-03-12 15:59 ` Peter Kjellerstedt [this message]

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=c1a2d05c715e4310b939dce81ccc243c@XBOX03.axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=idadelm@gmail.com \
    --cc=openembedded-core@lists.openembedded.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.