Add fix and test for [Yocto #6450]
cover Add fix and test for [Yocto #6450]
The following changes since commit bf1a68e97f2069a4f66664c351d4bafd416358eb:
taglib: Fix cmake floating dependency on boost (2015-03-02 18:06:53 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib rewitt/license_fix
for you to fetch changes up to a35e9afe37fe87921f0e9e915208364a271d89c3:
lib/oeqa/selftest/lic-checksum: Verify failure when checksum changes. (2015-03-02 10:28:23 -0800)
----------------------------------------------------------------
Randy Witt (2):
base.bbclass: Add LIC_FILES_CHKSUM files to checksum files. lib/oeqa/selftest/lic-checksum: Verify failure when checksum changes.
meta-selftest/recipes-test/emptytest/emptytest.bb | 5 ++++ meta/classes/base.bbclass | 17 ++++++++++++++ meta/lib/oeqa/selftest/lic-checksum.py | 28 +++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 meta-selftest/recipes-test/emptytest/emptytest.bb create mode 100644 meta/lib/oeqa/selftest/lic-checksum.py
PATCH 1/2 base.bbclass: Add LIC_FILES_CHKSUM files to checksum files.
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]
--- meta/classes/base.bbclass | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
meta/classes/base.bbclass +17 -0
@@ -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() {
Signature · 1 line
1.9.3
PATCH 2/2 lib/oeqa/selftest/lic-checksum: Verify failure when checksum changes.
In reply to Randy WittThe test added verifies that when a file with an absolute path in LIC_FILES_CHKSUM changes without a corresponding change to the md5sum, it triggers the license qa test again with a failure.
[Yocto #6450]
--- meta-selftest/recipes-test/emptytest/emptytest.bb | 5 ++++ meta/lib/oeqa/selftest/lic-checksum.py | 28 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 meta-selftest/recipes-test/emptytest/emptytest.bb create mode 100644 meta/lib/oeqa/selftest/lic-checksum.py
meta-selftest/recipes-test/emptytest/emptytest.bb new file +5 -0
@@ -0,0 +1,5 @@ +include test_recipe.inc + +# Set LICENSE to something so that bitbake -p that is ran at the beginning +# is successful since test_recipe.inc has not yet been modified. +LICENSE = ""
meta/lib/oeqa/selftest/lic-checksum.py new file +28 -0
@@ -0,0 +1,28 @@ +import os +import tempfile + +from oeqa.selftest.base import oeSelfTest +from oeqa.utils.commands import bitbake +from oeqa.utils import CommandError + +class LicenseTests(oeSelfTest): + + # Verify that changing a license file that has an absolute path causes + # the license qa to fail due to a mismatched md5sum. + def test_foo(self): + bitbake_cmd = '-c configure emptytest' + error_msg = 'ERROR: emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc' + + lic_file, lic_path = tempfile.mkstemp() + os.close(lic_file) + self.track_for_cleanup(lic_path) + + self.write_recipeinc('emptytest', 'LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"' % lic_path) + result = bitbake(bitbake_cmd) + + with open(lic_path, "w") as f: + f.write("data") + + result = bitbake(bitbake_cmd, ignore_status=True) + if error_msg not in result.output: + raise AssertionError(result.output)
Signature · 1 line
1.9.3