summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-28 15:20:59 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 18:41:52 +0000
commit9379f80f484f94686a4d494e9e237fadfb72a938 (patch)
tree6791e31dfa29c9fc12e579d8f1493fe00cad4b77 /meta/classes/insane.bbclass
parent0d19c45ba6cf43518f380ca5afe9753a2eda0691 (diff)
downloadopenembedded-core-9379f80f484f94686a4d494e9e237fadfb72a938.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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass31
1 files changed, 22 insertions, 9 deletions
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 \
mime mime-xdg unlisted-pkg-lics unhandled-features-check \
missing-update-alternatives native-last missing-ptest \
license-exists license-no-generic license-syntax license-format \
- license-incompatible license-file-missing \
+ license-incompatible license-file-missing obsolete-license \
"
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -909,14 +909,19 @@ def package_qa_check_unlisted_pkg_lics(package, d, messages):
return True
recipe_lics_set = oe.license.list_licenses(d.getVar('LICENSE'))
- unlisted = oe.license.list_licenses(pkg_lics) - recipe_lics_set
- if not unlisted:
- return True
-
- oe.qa.add_message(messages, "unlisted-pkg-lics",
- "LICENSE:%s includes licenses (%s) that are not "
- "listed in LICENSE" % (package, ' '.join(unlisted)))
- return False
+ package_lics = oe.license.list_licenses(pkg_lics)
+ unlisted = package_lics - recipe_lics_set
+ if unlisted:
+ oe.qa.add_message(messages, "unlisted-pkg-lics",
+ "LICENSE:%s includes licenses (%s) that are not "
+ "listed in LICENSE" % (package, ' '.join(unlisted)))
+ return False
+ obsolete = set(oe.license.obsolete_license_list()) & package_lics - recipe_lics_set
+ if obsolete:
+ oe.qa.add_message(messages, "obsolete-license",
+ "LICENSE:%s includes obsolete licenses %s" % (package, ' '.join(obsolete)))
+ return False
+ return True
QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
def package_qa_check_empty_dirs(pkg, d, messages):
@@ -1012,6 +1017,14 @@ python do_package_qa () {
bb.note("DO PACKAGE QA")
+ main_lic = d.getVar('LICENSE')
+
+ # Check for obsolete license references in main LICENSE (packages are checked below for any changes)
+ main_licenses = oe.license.list_licenses(d.getVar('LICENSE'))
+ obsolete = set(oe.license.obsolete_license_list()) & main_licenses
+ if obsolete:
+ oe.qa.handle_error("obsolete-license", "Recipe LICENSE includes obsolete licenses %s" % ' '.join(obsolete), d)
+
bb.build.exec_func("read_subpackage_metadata", d)
# Check non UTF-8 characters on recipe's metadata