summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/base.bbclass1
-rw-r--r--meta/classes/license.bbclass22
2 files changed, 23 insertions, 0 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 06cfe260ac..b8f61f3955 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -390,6 +390,7 @@ python () {
390 bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn) 390 bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
391 391
392 if bb.data.inherits_class('license', d): 392 if bb.data.inherits_class('license', d):
393 check_license_format(d)
393 unmatched_license_flag = check_license_flags(d) 394 unmatched_license_flag = check_license_flags(d)
394 if unmatched_license_flag: 395 if unmatched_license_flag:
395 bb.debug(1, "Skipping %s because it has a restricted license not" 396 bb.debug(1, "Skipping %s because it has a restricted license not"
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):
409 return unmatched_flag 409 return unmatched_flag
410 return None 410 return None
411 411
412def check_license_format(d):
413 """
414 This function checks if LICENSE is well defined,
415 Validate operators in LICENSES.
416 No spaces are allowed between LICENSES.
417 """
418 pn = d.getVar('PN', True)
419 licenses = d.getVar('LICENSE', True)
420 from oe.license import license_operator
421 from oe.license import license_pattern
422
423 elements = filter(lambda x: x.strip(), license_operator.split(licenses))
424 for pos, element in enumerate(elements):
425 if license_pattern.match(element):
426 if pos > 0 and license_pattern.match(elements[pos - 1]):
427 bb.warn("Recipe %s, LICENSE (%s) has invalid format, " \
428 "LICENSES must have operator \"%s\" between them." %
429 (pn, licenses, license_operator.pattern))
430 elif not license_operator.match(element):
431 bb.warn("Recipe %s, LICENSE (%s) has invalid operator (%s) not in" \
432 " \"%s\"." % (pn, licenses, element, license_operator.pattern))
433
412SSTATETASKS += "do_populate_lic" 434SSTATETASKS += "do_populate_lic"
413do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" 435do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
414do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/" 436do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"