All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steve Sakoman" <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][dunfell 11/17] base/insane: Check pkgs lics are subset of recipe lics only once
Date: Mon, 25 May 2020 12:36:57 -1000	[thread overview]
Message-ID: <ae404ef230882e442e9390b314e1ce023fdbbd1b.1590445868.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1590445868.git.steve@sakoman.com>

From: Quentin Schulz <quentin.schulz@streamunlimited.com>

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.

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>
---
 meta/classes/base.bbclass   | 13 -------------
 meta/classes/insane.bbclass | 21 ++++++++++++++++++++-
 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 () {
                         bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic)))
                         raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic))
 
-        # Try to verify per-package (LICENSE_<pkg>) values. LICENSE should be a
-        # superset of all per-package licenses. We do not do advanced (pattern)
-        # matching of license expressions - just check that all license strings
-        # in LICENSE_<pkg> are found in LICENSE.
-        license_set = oe.license.list_licenses(license)
-        for pkg in d.getVar('PACKAGES').split():
-            pkg_license = d.getVar('LICENSE_' + pkg)
-            if pkg_license:
-                unlisted = oe.license.list_licenses(pkg_license) - license_set
-                if unlisted:
-                    bb.warn("LICENSE_%s includes licenses (%s) that are not "
-                            "listed in LICENSE" % (pkg, ' '.join(unlisted)))
-
     needsrcrev = False
     srcuri = d.getVar('SRC_URI')
     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 \
             pn-overrides infodir build-deps src-uri-bad \
             unknown-configure-option symlink-to-sysroot multilib \
             invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
-            mime mime-xdg \
+            mime mime-xdg unlisted-pkg-lics \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -897,6 +897,25 @@ def package_qa_check_expanded_d(package, d, messages):
                 sane = False
     return sane
 
+QAPKGTEST[unlisted-pkg-lics] = "package_qa_check_unlisted_pkg_lics"
+def package_qa_check_unlisted_pkg_lics(package, d, messages):
+    """
+    Check that all licenses for a package are among the licenses for the recipe.
+    """
+    pkg_lics = d.getVar('LICENSE_' + package)
+    if not pkg_lics:
+        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
+
+    package_qa_add_message(messages, "unlisted-pkg-lics",
+                           "LICENSE_%s includes licenses (%s) that are not "
+                           "listed in LICENSE" % (package, ' '.join(unlisted)))
+    return False
+
 def package_qa_check_encoding(keys, encode, d):
     def check_encoding(key, enc):
         sane = True
-- 
2.17.1


  parent reply	other threads:[~2020-05-25 22:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 22:36 [OE-core][dunfell 00/17] Patch review Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 01/17] gcr: depends on gnupg-native Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 02/17] bison: fix the parallel build Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 03/17] archiver.bbclass: Make do_deploy_archives a recursive dependency Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 04/17] python3-setuptools: add the missing rdepends Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 05/17] recipes-kernel/linux-firmware: Add wlanmdsp.mbn to qcom-modem package Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 06/17] recipes-kernel/linux-firmware: Add adreno-a630 firmware package Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 07/17] linux-firmware: Update to 20200122 -> 20200421 Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 08/17] make-mod-scripts: Fix dependence error Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 09/17] libubootenv: Depend on zlib Steve Sakoman
2020-05-26  8:24   ` Paul Barker
2020-05-26  8:56     ` Adrian Bunk
2020-05-26  8:57       ` Paul Barker
2020-05-26  9:07         ` Stefano Babic
2020-05-25 22:36 ` [OE-core][dunfell 10/17] qemu: fix CVE-2020-11869 Steve Sakoman
2020-05-25 22:36 ` Steve Sakoman [this message]
2020-05-25 22:36 ` [OE-core][dunfell 12/17] testresults.json: add duration of the tests as well Steve Sakoman
2020-05-25 22:36 ` [OE-core][dunfell 13/17] file: add bzip2-replacement-native to DEPENDS to fix sstate issue Steve Sakoman
2020-05-25 22:37 ` [OE-core][dunfell 14/17] newlib: Upgrade to latest yearly release 3.3.0 Steve Sakoman
2020-05-26  8:31   ` Paul Barker
2020-05-26 13:59     ` Steve Sakoman
2020-05-25 22:37 ` [OE-core][dunfell 15/17] git: Upgrade 2.24.1 -> 2.24.3 Steve Sakoman
2020-05-25 22:37 ` [OE-core][dunfell 16/17] wireless-regdb: Upgrade 2019.06.03 -> 2020.04.29 Steve Sakoman
2020-05-25 22:37 ` [OE-core][dunfell 17/17] avahi: Don't advertise example services by default Steve Sakoman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae404ef230882e442e9390b314e1ce023fdbbd1b.1590445868.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.