diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-28 15:20:59 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 18:43:25 +0000 |
commit | 321cf8962ea2f3ce6b3942fe02ec2ce8d258cce3 (patch) | |
tree | 9543f6a8451452ffe632ff7b0125db59011f7343 /meta/classes | |
parent | d6449581c998a24145e527c571b3baf90a9f2518 (diff) | |
download | poky-321cf8962ea2f3ce6b3942fe02ec2ce8d258cce3.tar.gz |
license/insane: Show warning for obsolete license usage
We want to use SPDX identifiers in LICENSE variables. There is now a
conversion script to make most of the translations. Add a list of
strings which have been replaced so we can show warnings to users
if they're still used anywhere.
Add checks to the package as insane check. This is currently a warning
by default but can be turned off or made an error as per the other standard
checks.
(From OE-Core rev: 9379f80f484f94686a4d494e9e237fadfb72a938)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/base.bbclass | 6 | ||||
-rw-r--r-- | meta/classes/insane.bbclass | 31 |
2 files changed, 28 insertions, 9 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 1d5db96afb..966eadad67 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -597,6 +597,12 @@ python () { | |||
597 | 597 | ||
598 | exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() | 598 | exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() |
599 | 599 | ||
600 | for lic_exception in exceptions: | ||
601 | if ":" in lic_exception: | ||
602 | lic_exception.split(":")[0] | ||
603 | if lic_exception in oe.license.obsolete_license_list(): | ||
604 | bb.fatal("Invalid license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception) | ||
605 | |||
600 | pkgs = d.getVar('PACKAGES').split() | 606 | pkgs = d.getVar('PACKAGES').split() |
601 | skipped_pkgs = {} | 607 | skipped_pkgs = {} |
602 | unskipped_pkgs = [] | 608 | unskipped_pkgs = [] |
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 29b9b3d466..3c8d49f13b 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
@@ -27,7 +27,7 @@ WARN_QA ?= " libdir xorg-driver-abi \ | |||
27 | mime mime-xdg unlisted-pkg-lics unhandled-features-check \ | 27 | mime mime-xdg unlisted-pkg-lics unhandled-features-check \ |
28 | missing-update-alternatives native-last missing-ptest \ | 28 | missing-update-alternatives native-last missing-ptest \ |
29 | license-exists license-no-generic license-syntax license-format \ | 29 | license-exists license-no-generic license-syntax license-format \ |
30 | license-incompatible license-file-missing \ | 30 | license-incompatible license-file-missing obsolete-license \ |
31 | " | 31 | " |
32 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ | 32 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ |
33 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ | 33 | perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ |
@@ -909,14 +909,19 @@ def package_qa_check_unlisted_pkg_lics(package, d, messages): | |||
909 | return True | 909 | return True |
910 | 910 | ||
911 | recipe_lics_set = oe.license.list_licenses(d.getVar('LICENSE')) | 911 | recipe_lics_set = oe.license.list_licenses(d.getVar('LICENSE')) |
912 | unlisted = oe.license.list_licenses(pkg_lics) - recipe_lics_set | 912 | package_lics = oe.license.list_licenses(pkg_lics) |
913 | if not unlisted: | 913 | unlisted = package_lics - recipe_lics_set |
914 | return True | 914 | if unlisted: |
915 | 915 | oe.qa.add_message(messages, "unlisted-pkg-lics", | |
916 | oe.qa.add_message(messages, "unlisted-pkg-lics", | 916 | "LICENSE:%s includes licenses (%s) that are not " |
917 | "LICENSE:%s includes licenses (%s) that are not " | 917 | "listed in LICENSE" % (package, ' '.join(unlisted))) |
918 | "listed in LICENSE" % (package, ' '.join(unlisted))) | 918 | return False |
919 | return False | 919 | obsolete = set(oe.license.obsolete_license_list()) & package_lics - recipe_lics_set |
920 | if obsolete: | ||
921 | oe.qa.add_message(messages, "obsolete-license", | ||
922 | "LICENSE:%s includes obsolete licenses %s" % (package, ' '.join(obsolete))) | ||
923 | return False | ||
924 | return True | ||
920 | 925 | ||
921 | QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs" | 926 | QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs" |
922 | def package_qa_check_empty_dirs(pkg, d, messages): | 927 | def package_qa_check_empty_dirs(pkg, d, messages): |
@@ -1012,6 +1017,14 @@ python do_package_qa () { | |||
1012 | 1017 | ||
1013 | bb.note("DO PACKAGE QA") | 1018 | bb.note("DO PACKAGE QA") |
1014 | 1019 | ||
1020 | main_lic = d.getVar('LICENSE') | ||
1021 | |||
1022 | # Check for obsolete license references in main LICENSE (packages are checked below for any changes) | ||
1023 | main_licenses = oe.license.list_licenses(d.getVar('LICENSE')) | ||
1024 | obsolete = set(oe.license.obsolete_license_list()) & main_licenses | ||
1025 | if obsolete: | ||
1026 | oe.qa.handle_error("obsolete-license", "Recipe LICENSE includes obsolete licenses %s" % ' '.join(obsolete), d) | ||
1027 | |||
1015 | bb.build.exec_func("read_subpackage_metadata", d) | 1028 | bb.build.exec_func("read_subpackage_metadata", d) |
1016 | 1029 | ||
1017 | # Check non UTF-8 characters on recipe's metadata | 1030 | # Check non UTF-8 characters on recipe's metadata |