summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/license.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-08-03 16:32:15 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-25 22:54:49 +0100
commit988f77af3eaf49692bbd456bfe692c507dfa5fbe (patch)
treed40c0541970def3e888910bd96e87758d89b2ca0 /meta/lib/oe/license.py
parent831e98325195f5631b977365fd61c3910a2c23a5 (diff)
downloadpoky-988f77af3eaf49692bbd456bfe692c507dfa5fbe.tar.gz
license: simple verification of LICENSE_<pkg> values
LICENSE should be a superset of all LICENSE_<pkg> values. That is, LICENSE should contain all licenses and LICENSE_<pkg> can be used to "filter" this on a per-package basis. LICENSE_<pkg> shouldn't contain anything that isn't specified in LICENSE. This patch implements simple checking of LICENSE_<pkg> values. It does do not do advanced parsing/matching of license expressions, but, checks that all licenses mentioned in LICENSE_<pkg> are also specified in LICENSE. A warning is printed if problems are found. (From OE-Core rev: 0f4163a12ea431d0ba6265880ee1e557333d3211) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/license.py')
-rw-r--r--meta/lib/oe/license.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 39ef9654fc..8d2fd1709c 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -215,3 +215,21 @@ def manifest_licenses(licensestr, dont_want_licenses, canonical_license, d):
215 manifest.licensestr = manifest.licensestr.replace('[', '(').replace(']', ')') 215 manifest.licensestr = manifest.licensestr.replace('[', '(').replace(']', ')')
216 216
217 return (manifest.licensestr, manifest.licenses) 217 return (manifest.licensestr, manifest.licenses)
218
219class ListVisitor(LicenseVisitor):
220 """Record all different licenses found in the license string"""
221 def __init__(self):
222 self.licenses = set()
223
224 def visit_Str(self, node):
225 self.licenses.add(node.s)
226
227def list_licenses(licensestr):
228 """Simply get a list of all licenses mentioned in a license string.
229 Binary operators are not applied or taken into account in any way"""
230 visitor = ListVisitor()
231 try:
232 visitor.visit_string(licensestr)
233 except SyntaxError as exc:
234 raise LicenseSyntaxError(licensestr, exc)
235 return visitor.licenses