]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
classes/license: tweak license format messages
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 3 Feb 2015 15:28:52 +0000 (15:28 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 7 Feb 2015 13:30:57 +0000 (13:30 +0000)
Strictly speaking not all of these characters are operators, so reword
the message to describe them as separators. Also use the standard
"recipename: message" format.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/license.bbclass
meta/lib/oe/license.py

index d659b767c586fc4065c96cbd51a741fa37249831..21465d8d00ef432b69829538702949525395be3d 100644 (file)
@@ -417,19 +417,20 @@ def check_license_format(d):
     """
     pn = d.getVar('PN', True)
     licenses = d.getVar('LICENSE', True)
-    from oe.license import license_operator
-    from oe.license import license_pattern
+    from oe.license import license_operator, license_operator_chars, 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))
+                bb.warn('%s: LICENSE value "%s" has an invalid format - license names ' \
+                        'must be separated by the following characters to indicate ' \
+                        'the license selection: %s' %
+                        (pn, licenses, license_operator_chars))
         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))
+            bb.warn('%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \
+                    'in the valid list of separators (%s)' %
+                    (pn, licenses, element, license_operator_chars))
 
 SSTATETASKS += "do_populate_lic"
 do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
index 340da61102f760eb727fdcb5c63432d6da1fe951..31ca15b5746484471d1cc162f61ba533184ffa88 100644 (file)
@@ -25,7 +25,8 @@ class InvalidLicense(LicenseError):
     def __str__(self):
         return "invalid characters in license '%s'" % self.license
 
-license_operator = re.compile('([&|() ])')
+license_operator_chars = '&|() '
+license_operator = re.compile('([' + license_operator_chars + '])')
 license_pattern = re.compile('[a-zA-Z0-9.+_\-]+$')
 
 class LicenseVisitor(ast.NodeVisitor):