diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2014-12-22 17:30:46 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-25 08:18:12 +0000 |
commit | 3ef9f83ab7040684cbc62b276a2598cce55e6c8d (patch) | |
tree | 316cb237d1f2a777af19fb8600127081f8f58c68 /meta/classes/license.bbclass | |
parent | 101c3bf7f573dd624ecfa24f1a5c44f8abadfe40 (diff) | |
download | openembedded-core-contrib-3ef9f83ab7040684cbc62b276a2598cce55e6c8d.tar.gz |
license: Validate if LICENSE is well defined.
Add check_license_format function that shows warning if LICENSE don't have
valid operators and also if have space separated entries without operator,
add check_license_format validation into base class.
[YOCTO #6758]
(From OE-Core rev: 346a023a42f127881476e760e8fa4e04303849b9)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index c55ee77ebf..f85d4f9bcf 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass @@ -409,6 +409,28 @@ def check_license_flags(d): return unmatched_flag return None +def check_license_format(d): + """ + This function checks if LICENSE is well defined, + Validate operators in LICENSES. + No spaces are allowed between LICENSES. + """ + pn = d.getVar('PN', True) + licenses = d.getVar('LICENSE', True) + from oe.license import license_operator + from oe.license import license_pattern + + elements = filter(lambda x: x.strip(), license_operator.split(licenses)) + for pos, element in enumerate(elements): + if license_pattern.match(element): + if pos > 0 and license_pattern.match(elements[pos - 1]): + bb.warn("Recipe %s, LICENSE (%s) has invalid format, " \ + "LICENSES must have operator \"%s\" between them." % + (pn, licenses, license_operator.pattern)) + elif not license_operator.match(element): + bb.warn("Recipe %s, LICENSE (%s) has invalid operator (%s) not in" \ + " \"%s\"." % (pn, licenses, element, license_operator.pattern)) + SSTATETASKS += "do_populate_lic" do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/" |