public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Meh Mbeh Ida Delphine" <idadelm@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [poky-contrib][RFC PATCH 4/5] license.bbclass: Add functions to split and canonicalise license strings
Date: Wed, 17 Feb 2021 05:00:32 +0100	[thread overview]
Message-ID: <20210217040033.21541-5-idadelm@gmail.com> (raw)
In-Reply-To: <20210217040033.21541-1-idadelm@gmail.com>

These functions that will later be used in package.bbclass simply make the source and recipe licenses in the same format so that they can easily be compared and the ouput warnings filtered accordingly.
split_spdx_lic() splits the license strings and returns a set of the canonicalised licenses.
rem_false_lics() does two things:
- Converts '-or-later' licenses to their canonicalised form
- Gets rid of "WITH Linux-syscall-note" from license string if specified in local.conf

Signed-off-by: Ida Delphine <idadelm@gmail.com>
---
 meta/classes/license.bbclass | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index dc91118340..576464cb26 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -435,3 +435,30 @@ python do_populate_lic_setscene () {
     sstate_setscene(d)
 }
 addtask do_populate_lic_setscene
+
+
+def split_spdx_lic(d, licensestr):
+    """
+    Split the license strings and returns a set of the
+    canonicalised licenses.
+    """
+    import oe.license
+    split_lic = oe.license.list_licenses(licensestr)
+    spdx_lic = set([canonical_license(d, l) for l in split_lic])
+    return spdx_lic
+
+def rem_false_lics(d, pkglic):
+    pkglicsperpkg = set([])
+    for l in pkglic:
+        if l.endswith('-or-later'):
+            # Converts '-or-later' licenses to their canonicalised form
+            lic_ = l.replace('-or-later', '+')
+            pkglicsperpkg.add(lic_)
+        elif l.endswith(' WITH Linux-syscall-note'):
+        # Gets rid of "WITH Linux-syscall-note from license sring"
+            if d.getVar("LICENSE_WITH_LINUX_SYS") == "1":
+                lic_ = l.replace(' WITH Linux-syscall-note', '')
+                pkglicsperpkg.add(lic_)
+        else:
+            pkglicsperpkg.add(l)
+    return pkglicsperpkg
\ No newline at end of file
-- 
2.25.1


  parent reply	other threads:[~2021-02-17  4:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17  4:00 [poky-contrib][RFC PATCH 0/5] Suggestions for improvements? Meh Mbeh Ida Delphine
2021-02-17  4:00 ` [poky-contrib][RFC PATCH 1/5] package: Remove false positive lic warnings Meh Mbeh Ida Delphine
2021-02-17 10:42   ` [OE-core] " Richard Purdie
2021-02-17  4:00 ` [poky-contrib][RFC PATCH 2/5] " Meh Mbeh Ida Delphine
2021-02-17 10:39   ` [OE-core] " Richard Purdie
2021-02-17 14:55     ` Peter Kjellerstedt
2021-02-17 15:04       ` Richard Purdie
2021-02-17  4:00 ` [poky-contrib][RFC PATCH 3/5] " Meh Mbeh Ida Delphine
2021-02-17  4:00 ` Meh Mbeh Ida Delphine [this message]
2021-02-17 10:45   ` [OE-core] [poky-contrib][RFC PATCH 4/5] license.bbclass: Add functions to split and canonicalise license strings Richard Purdie
2021-02-17 15:04   ` Peter Kjellerstedt
2021-02-17 16:36     ` Richard Purdie
2021-02-17 16:55       ` Meh Mbeh Ida Delphine
2021-02-17 20:51         ` Richard Purdie
2021-02-21  3:04           ` Meh Mbeh Ida Delphine
2021-02-21 11:21             ` Richard Purdie
2021-02-17  4:00 ` [poky-contrib][RFC PATCH 5/5] package.bbclass: Remove false positive license warnings Meh Mbeh Ida Delphine
2021-02-17 15:50 ` [OE-core] [poky-contrib][RFC PATCH 0/5] Suggestions for improvements? Peter Kjellerstedt
2021-02-17 16:58   ` Meh Mbeh Ida Delphine
2021-02-18 11:17     ` Peter Kjellerstedt
2021-02-18 12:21       ` Meh Mbeh Ida Delphine

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=20210217040033.21541-5-idadelm@gmail.com \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox