summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorQuentin Schulz <quentin.schulz@streamunlimited.com>2020-04-20 22:13:29 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-05-28 18:15:29 +0100
commitb7fa39c31a060b42dc4b592299dc9def10a93709 (patch)
tree9ba5a28320e0f9e205f35d983af56844c1245ddd /meta/classes
parent0a8d17cdbe29847eccba4846f568b2015230f543 (diff)
downloadpoky-b7fa39c31a060b42dc4b592299dc9def10a93709.tar.gz
base/insane: Check pkgs lics are subset of recipe lics only once
Move logic checking that all packages licenses are only a subset of recipe licenses from base.bbclass to the insane.bbclass so that it's evaluated only once, during do_package_qa. As explained in the linked bugzilla entry, if a package license is not part of the recipe license, the warning message gets shown an unreasonable amount of time because it's evaluated every time a recipe is parsed. [YOCTO #10130] This also makes it possible to silence this error with INSANE_SKIP. (From OE-Core rev: ae404ef230882e442e9390b314e1ce023fdbbd1b) Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 852408ed4be1f64c57e196688728b7ed223d3493) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/base.bbclass13
-rw-r--r--meta/classes/insane.bbclass21
2 files changed, 20 insertions, 14 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 45f9435fd8..7aa2e144eb 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -584,19 +584,6 @@ python () {
584 bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic))) 584 bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic)))
585 raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic)) 585 raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic))
586 586
587 # Try to verify per-package (LICENSE_<pkg>) values. LICENSE should be a
588 # superset of all per-package licenses. We do not do advanced (pattern)
589 # matching of license expressions - just check that all license strings
590 # in LICENSE_<pkg> are found in LICENSE.
591 license_set = oe.license.list_licenses(license)
592 for pkg in d.getVar('PACKAGES').split():
593 pkg_license = d.getVar('LICENSE_' + pkg)
594 if pkg_license:
595 unlisted = oe.license.list_licenses(pkg_license) - license_set
596 if unlisted:
597 bb.warn("LICENSE_%s includes licenses (%s) that are not "
598 "listed in LICENSE" % (pkg, ' '.join(unlisted)))
599
600 needsrcrev = False 587 needsrcrev = False
601 srcuri = d.getVar('SRC_URI') 588 srcuri = d.getVar('SRC_URI')
602 for uri in srcuri.split(): 589 for uri in srcuri.split():
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 7fc8f33a98..3a0efa3ad6 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -28,7 +28,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
28 pn-overrides infodir build-deps src-uri-bad \ 28 pn-overrides infodir build-deps src-uri-bad \
29 unknown-configure-option symlink-to-sysroot multilib \ 29 unknown-configure-option symlink-to-sysroot multilib \
30 invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ 30 invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
31 mime mime-xdg \ 31 mime mime-xdg unlisted-pkg-lics \
32 " 32 "
33ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ 33ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
34 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ 34 perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -897,6 +897,25 @@ def package_qa_check_expanded_d(package, d, messages):
897 sane = False 897 sane = False
898 return sane 898 return sane
899 899
900QAPKGTEST[unlisted-pkg-lics] = "package_qa_check_unlisted_pkg_lics"
901def package_qa_check_unlisted_pkg_lics(package, d, messages):
902 """
903 Check that all licenses for a package are among the licenses for the recipe.
904 """
905 pkg_lics = d.getVar('LICENSE_' + package)
906 if not pkg_lics:
907 return True
908
909 recipe_lics_set = oe.license.list_licenses(d.getVar('LICENSE'))
910 unlisted = oe.license.list_licenses(pkg_lics) - recipe_lics_set
911 if not unlisted:
912 return True
913
914 package_qa_add_message(messages, "unlisted-pkg-lics",
915 "LICENSE_%s includes licenses (%s) that are not "
916 "listed in LICENSE" % (package, ' '.join(unlisted)))
917 return False
918
900def package_qa_check_encoding(keys, encode, d): 919def package_qa_check_encoding(keys, encode, d):
901 def check_encoding(key, enc): 920 def check_encoding(key, enc):
902 sane = True 921 sane = True