diff options
| -rw-r--r-- | meta/classes/insane.bbclass | 36 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/lic-checksum.py | 2 |
2 files changed, 22 insertions, 16 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 70d5fb828d..f7781ce6fe 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -38,6 +38,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | |||
| 38 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ | 38 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ |
| 39 | split-strip packages-list pkgv-undefined var-undefined \ | 39 | split-strip packages-list pkgv-undefined var-undefined \ |
| 40 | version-going-backwards expanded-d invalid-chars \ | 40 | version-going-backwards expanded-d invalid-chars \ |
| 41 | license-checksum \ | ||
| 41 | " | 42 | " |
| 42 | FAKEROOT_QA = "host-user-contaminated" | 43 | FAKEROOT_QA = "host-user-contaminated" |
| 43 | FAKEROOT_QA[doc] = "QA tests which need to run under fakeroot. If any \ | 44 | FAKEROOT_QA[doc] = "QA tests which need to run under fakeroot. If any \ |
| @@ -631,6 +632,7 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages): | |||
| 631 | if target.startswith(tmpdir): | 632 | if target.startswith(tmpdir): |
| 632 | trimmed = path.replace(os.path.join (d.getVar("PKGDEST", True), name), "") | 633 | trimmed = path.replace(os.path.join (d.getVar("PKGDEST", True), name), "") |
| 633 | messages["symlink-to-sysroot"] = "Symlink %s in %s points to TMPDIR" % (trimmed, name) | 634 | messages["symlink-to-sysroot"] = "Symlink %s in %s points to TMPDIR" % (trimmed, name) |
| 635 | |||
| 634 | def package_qa_check_license(workdir, d): | 636 | def package_qa_check_license(workdir, d): |
| 635 | """ | 637 | """ |
| 636 | Check for changes in the license files | 638 | Check for changes in the license files |
| @@ -643,11 +645,11 @@ def package_qa_check_license(workdir, d): | |||
| 643 | pn = d.getVar('PN', True) | 645 | pn = d.getVar('PN', True) |
| 644 | 646 | ||
| 645 | if lic == "CLOSED": | 647 | if lic == "CLOSED": |
| 646 | return True | 648 | return |
| 647 | 649 | ||
| 648 | if not lic_files: | 650 | if not lic_files: |
| 649 | bb.error(pn + ": Recipe file does not have license file information (LIC_FILES_CHKSUM)") | 651 | package_qa_handle_error("license-checksum", pn + ": Recipe file does not have license file information (LIC_FILES_CHKSUM)", d) |
| 650 | return False | 652 | return |
| 651 | 653 | ||
| 652 | srcdir = d.getVar('S', True) | 654 | srcdir = d.getVar('S', True) |
| 653 | 655 | ||
| @@ -655,10 +657,12 @@ def package_qa_check_license(workdir, d): | |||
| 655 | try: | 657 | try: |
| 656 | (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url) | 658 | (type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url) |
| 657 | except bb.fetch.MalformedUrl: | 659 | except bb.fetch.MalformedUrl: |
| 658 | raise bb.build.FuncFailed( pn + ": LIC_FILES_CHKSUM contains an invalid URL: " + url) | 660 | package_qa_handle_error("license-checksum", pn + ": LIC_FILES_CHKSUM contains an invalid URL: " + url, d) |
| 661 | continue | ||
| 659 | srclicfile = os.path.join(srcdir, path) | 662 | srclicfile = os.path.join(srcdir, path) |
| 660 | if not os.path.isfile(srclicfile): | 663 | if not os.path.isfile(srclicfile): |
| 661 | raise bb.build.FuncFailed( pn + ": LIC_FILES_CHKSUM points to an invalid file: " + srclicfile) | 664 | package_qa_handle_error("license-checksum", pn + ": LIC_FILES_CHKSUM points to an invalid file: " + srclicfile, d) |
| 665 | continue | ||
| 662 | 666 | ||
| 663 | recipemd5 = parm.get('md5', '') | 667 | recipemd5 = parm.get('md5', '') |
| 664 | beginline, endline = 0, 0 | 668 | beginline, endline = 0, 0 |
| @@ -693,8 +697,8 @@ def package_qa_check_license(workdir, d): | |||
| 693 | bb.note (pn + ": md5 checksum matched for ", url) | 697 | bb.note (pn + ": md5 checksum matched for ", url) |
| 694 | else: | 698 | else: |
| 695 | if recipemd5: | 699 | if recipemd5: |
| 696 | bb.error(pn + ": md5 data is not matching for ", url) | 700 | msg = pn + ": The LIC_FILES_CHKSUM does not match for " + url |
| 697 | bb.error(pn + ": The new md5 checksum is ", md5chksum) | 701 | msg = msg + "\n" + pn + ": The new md5 checksum is " + md5chksum |
| 698 | if beginline: | 702 | if beginline: |
| 699 | if endline: | 703 | if endline: |
| 700 | srcfiledesc = "%s (lines %d through to %d)" % (srclicfile, beginline, endline) | 704 | srcfiledesc = "%s (lines %d through to %d)" % (srclicfile, beginline, endline) |
| @@ -704,13 +708,12 @@ def package_qa_check_license(workdir, d): | |||
| 704 | srcfiledesc = "%s (ending on line %d)" % (srclicfile, endline) | 708 | srcfiledesc = "%s (ending on line %d)" % (srclicfile, endline) |
| 705 | else: | 709 | else: |
| 706 | srcfiledesc = srclicfile | 710 | srcfiledesc = srclicfile |
| 707 | bb.error(pn + ": Check if the license information has changed in %s to verify that the LICENSE value \"%s\" remains valid" % (srcfiledesc, lic)) | 711 | msg = msg + "\n" + pn + ": Check if the license information has changed in %s to verify that the LICENSE value \"%s\" remains valid" % (srcfiledesc, lic) |
| 708 | else: | ||
| 709 | bb.error(pn + ": md5 checksum is not specified for ", url) | ||
| 710 | bb.error(pn + ": The md5 checksum is ", md5chksum) | ||
| 711 | sane = False | ||
| 712 | 712 | ||
| 713 | return sane | 713 | else: |
| 714 | msg = pn + ": LIC_FILES_CHKSUM is not specified for " + url | ||
| 715 | msg = msg + "\n" + pn + ": The md5 checksum is " + md5chksum | ||
| 716 | package_qa_handle_error("license-checksum", msg, d) | ||
| 714 | 717 | ||
| 715 | def package_qa_check_staged(path,d): | 718 | def package_qa_check_staged(path,d): |
| 716 | """ | 719 | """ |
| @@ -1160,8 +1163,7 @@ Missing inherit gettext?""" % (gt, config)) | |||
| 1160 | # Check license variables | 1163 | # Check license variables |
| 1161 | ########################################################################### | 1164 | ########################################################################### |
| 1162 | 1165 | ||
| 1163 | if not package_qa_check_license(workdir, d): | 1166 | package_qa_check_license(workdir, d) |
| 1164 | bb.fatal("Licensing Error: LIC_FILES_CHKSUM does not match, please fix") | ||
| 1165 | 1167 | ||
| 1166 | ########################################################################### | 1168 | ########################################################################### |
| 1167 | # Check unrecognised configure options (with a white list) | 1169 | # Check unrecognised configure options (with a white list) |
| @@ -1193,6 +1195,10 @@ Missing inherit gettext?""" % (gt, config)) | |||
| 1193 | pn = d.getVar('PN', True) | 1195 | pn = d.getVar('PN', True) |
| 1194 | error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig) | 1196 | error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig) |
| 1195 | package_qa_handle_error("invalid-packageconfig", error_msg, d) | 1197 | package_qa_handle_error("invalid-packageconfig", error_msg, d) |
| 1198 | |||
| 1199 | qa_sane = d.getVar("QA_SANE", True) | ||
| 1200 | if not qa_sane: | ||
| 1201 | bb.fatal("Fatal QA errors found, failing task.") | ||
| 1196 | } | 1202 | } |
| 1197 | 1203 | ||
| 1198 | python do_qa_unpack() { | 1204 | python do_qa_unpack() { |
diff --git a/meta/lib/oeqa/selftest/lic-checksum.py b/meta/lib/oeqa/selftest/lic-checksum.py index bd3b9a1ba3..cac6d84452 100644 --- a/meta/lib/oeqa/selftest/lic-checksum.py +++ b/meta/lib/oeqa/selftest/lic-checksum.py | |||
| @@ -13,7 +13,7 @@ class LicenseTests(oeSelfTest): | |||
| 13 | @testcase(1197) | 13 | @testcase(1197) |
| 14 | def test_nonmatching_checksum(self): | 14 | def test_nonmatching_checksum(self): |
| 15 | bitbake_cmd = '-c configure emptytest' | 15 | bitbake_cmd = '-c configure emptytest' |
| 16 | error_msg = 'ERROR: emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc' | 16 | error_msg = 'emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc' |
| 17 | 17 | ||
| 18 | lic_file, lic_path = tempfile.mkstemp() | 18 | lic_file, lic_path = tempfile.mkstemp() |
| 19 | os.close(lic_file) | 19 | os.close(lic_file) |
