]> code.ossystems Code Review - openembedded-core.git/commitdiff
base.bbclass: Add LIC_FILES_CHKSUM files to checksum files.
authorRandy Witt <randy.e.witt@linux.intel.com>
Mon, 2 Mar 2015 18:55:37 +0000 (10:55 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 9 Mar 2015 16:00:19 +0000 (16:00 +0000)
Previously, files with absolute paths in LIC_FILES_CHKSUM such as
"file://${COMMON_LICENSE_DIR}/foo" would not result in a qa failure
when the license file changed.

To fix this problem, add any files with absolute paths from
LIC_FILES_CHKSUM to the file-checksums varflag, so that changes in the
license file are detected and cause the qa task for licenses to run.

[Yocto #6450]

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/base.bbclass

index 789af3b10b730994add3f90af50ced9c3f0d3379..2c2d0192f1d5a930e44634a0ec108190ca6fa5d7 100644 (file)
@@ -94,9 +94,26 @@ def extra_path_elements(d):
 
 PATH_prepend = "${@extra_path_elements(d)}"
 
+def get_lic_checksum_file_list(d):
+    filelist = []
+    lic_files = d.getVar("LIC_FILES_CHKSUM", True) or ''
+
+    urls = lic_files.split()
+    for url in urls:
+        # We only care about items that are absolute paths since
+        # any others should be covered by SRC_URI.
+        try:
+            path = bb.fetch.decodeurl(url)[2]
+            if path[0] == '/':
+                filelist.append(path + ":" + str(os.path.exists(path)))
+        except bb.fetch.MalformedUrl:
+            raise bb.build.FuncFailed(d.getVar('PN', True) + ": LIC_FILES_CHKSUM contains an invalid URL: " + url)
+    return " ".join(filelist)
+
 addtask fetch
 do_fetch[dirs] = "${DL_DIR}"
 do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
+do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}"
 do_fetch[vardeps] += "SRCREV"
 python base_do_fetch() {