]> code.ossystems Code Review - openembedded-core.git/commitdiff
classes/insane: improve LIC_FILES_CHKSUM messages
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 13 Nov 2013 14:32:39 +0000 (14:32 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Nov 2013 13:37:40 +0000 (13:37 +0000)
* If the md5 parameter is specified with no value, report that the
  checksum is not specified instead of reporting that it has changed
* If the md5 checksum has changed, point directly to the license file in
  a way that is easy to copy and paste and give the line numbers in an
  easy to read form, as well as asking the user to verify that the new
  contents matches the current LICENSE value.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/insane.bbclass

index 3558dee1b0a0749dc91c405bd635fb0e216d2e1f..f9f8deffa326154af768dccf301d0b84e209370b 100644 (file)
@@ -602,7 +602,8 @@ def package_qa_check_license(workdir, d):
         if not os.path.isfile(srclicfile):
             raise bb.build.FuncFailed( pn + ": LIC_FILES_CHKSUM points to an invalid file: " + srclicfile)
 
-        if 'md5' not in parm:
+        recipemd5 = parm.get('md5', '')
+        if not recipemd5:
             bb.error(pn + ": md5 checksum is not specified for ", url)
             return False
         beginline, endline = 0, 0
@@ -633,12 +634,21 @@ def package_qa_check_license(workdir, d):
             md5chksum = bb.utils.md5_file(tmplicfile)
             os.unlink(tmplicfile)
 
-        if parm['md5'] == md5chksum:
+        if recipemd5 == md5chksum:
             bb.note (pn + ": md5 checksum matched for ", url)
         else:
             bb.error (pn + ": md5 data is not matching for ", url)
             bb.error (pn + ": The new md5 checksum is ", md5chksum)
-            bb.error (pn + ": Check if the license information has changed in")
+            if beginline:
+                if endline:
+                    srcfiledesc = "%s (lines %d through to %d)" % (srclicfile, beginline, endline)
+                else:
+                    srcfiledesc = "%s (beginning on line %d)" % (srclicfile, beginline)
+            elif endline:
+                srcfiledesc = "%s (ending on line %d)" % (srclicfile, endline)
+            else:
+                srcfiledesc = srclicfile
+            bb.error(pn + ": Check if the license information has changed in %s to verify that the LICENSE value \"%s\" remains valid" % (srcfiledesc, lic))
             sane = False
 
     return sane