diff options
-rw-r--r-- | meta/classes/license.bbclass | 15 | ||||
-rw-r--r-- | meta/lib/oe/license.py | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index d659b767c5..21465d8d00 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -417,19 +417,20 @@ def check_license_format(d): | |||
417 | """ | 417 | """ |
418 | pn = d.getVar('PN', True) | 418 | pn = d.getVar('PN', True) |
419 | licenses = d.getVar('LICENSE', True) | 419 | licenses = d.getVar('LICENSE', True) |
420 | from oe.license import license_operator | 420 | from oe.license import license_operator, license_operator_chars, license_pattern |
421 | from oe.license import license_pattern | ||
422 | 421 | ||
423 | elements = filter(lambda x: x.strip(), license_operator.split(licenses)) | 422 | elements = filter(lambda x: x.strip(), license_operator.split(licenses)) |
424 | for pos, element in enumerate(elements): | 423 | for pos, element in enumerate(elements): |
425 | if license_pattern.match(element): | 424 | if license_pattern.match(element): |
426 | if pos > 0 and license_pattern.match(elements[pos - 1]): | 425 | if pos > 0 and license_pattern.match(elements[pos - 1]): |
427 | bb.warn("Recipe %s, LICENSE (%s) has invalid format, " \ | 426 | bb.warn('%s: LICENSE value "%s" has an invalid format - license names ' \ |
428 | "LICENSES must have operator \"%s\" between them." % | 427 | 'must be separated by the following characters to indicate ' \ |
429 | (pn, licenses, license_operator.pattern)) | 428 | 'the license selection: %s' % |
429 | (pn, licenses, license_operator_chars)) | ||
430 | elif not license_operator.match(element): | 430 | elif not license_operator.match(element): |
431 | bb.warn("Recipe %s, LICENSE (%s) has invalid operator (%s) not in" \ | 431 | bb.warn('%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \ |
432 | " \"%s\"." % (pn, licenses, element, license_operator.pattern)) | 432 | 'in the valid list of separators (%s)' % |
433 | (pn, licenses, element, license_operator_chars)) | ||
433 | 434 | ||
434 | SSTATETASKS += "do_populate_lic" | 435 | SSTATETASKS += "do_populate_lic" |
435 | do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" | 436 | do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}" |
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index 340da61102..31ca15b574 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py | |||
@@ -25,7 +25,8 @@ class InvalidLicense(LicenseError): | |||
25 | def __str__(self): | 25 | def __str__(self): |
26 | return "invalid characters in license '%s'" % self.license | 26 | return "invalid characters in license '%s'" % self.license |
27 | 27 | ||
28 | license_operator = re.compile('([&|() ])') | 28 | license_operator_chars = '&|() ' |
29 | license_operator = re.compile('([' + license_operator_chars + '])') | ||
29 | license_pattern = re.compile('[a-zA-Z0-9.+_\-]+$') | 30 | license_pattern = re.compile('[a-zA-Z0-9.+_\-]+$') |
30 | 31 | ||
31 | class LicenseVisitor(ast.NodeVisitor): | 32 | class LicenseVisitor(ast.NodeVisitor): |