Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [OE-core][PATCH v2 3/4] lib: package: Check incompatible licenses at packaging time
Date: Wed, 23 Oct 2024 15:15:21 -0600	[thread overview]
Message-ID: <20241023212013.995247-4-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20241023212013.995247-1-JPEWhacker@gmail.com>

Instead of checking for incompatible licenses in the anonymous python
and setting '_exclude_incompatible-', (re)check all the packages in
populate_packages(). This ensures that all packages are processed, even
dynamically generated ones.

The use of the '_exclude-incompatible-' variable set in base.bbclass has
been the mechanism used for per-packages licenses since its it was added
as a feature (although with different names for the variable throughout
history). However, since this misses dynamic packages, calling
oe.license.skip_incompatible_package_licenses() a second time on the
actual final package set is a better solution.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes-global/base.bbclass | 1 -
 meta/lib/oe/package.py           | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 5b8663f454d..b81e61fdb72 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -581,7 +581,6 @@ python () {
             if unskipped_pkgs:
                 for pkg in skipped_pkgs:
                     bb.debug(1, "Skipping the package %s at do_rootfs because of incompatible license(s): %s" % (pkg, ' '.join(skipped_pkgs[pkg])))
-                    d.setVar('_exclude_incompatible-' + pkg, ' '.join(skipped_pkgs[pkg]))
                 for pkg in unskipped_pkgs:
                     bb.debug(1, "Including the package %s" % pkg)
             else:
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index c213a9a3ca6..480408e41e3 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -1447,10 +1447,10 @@ def populate_packages(d):
 
     # Handle excluding packages with incompatible licenses
     package_list = []
+    skipped_pkgs = oe.license.skip_incompatible_package_licenses(d, pkgs):
     for pkg in packages:
-        licenses = d.getVar('_exclude_incompatible-' + pkg)
-        if licenses:
-            msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses)
+        if pkg in skipped_pkgs:
+            msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, skipped_pkgs[pkg])
             oe.qa.handle_error("incompatible-license", msg, d)
         else:
             package_list.append(pkg)
-- 
2.46.2



  parent reply	other threads:[~2024-10-23 21:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 21:59 [OE-core][PATCH 0/4] Incompatible license handling fixes Joshua Watt
2024-10-18 21:59 ` [OE-core][PATCH 1/4] classes-global/license: Move functions to library code Joshua Watt
2024-10-18 21:59 ` [OE-core][PATCH 2/4] lib: license: Move package license skip to library Joshua Watt
2024-10-18 21:59 ` [OE-core][PATCH 3/4] lib: package: Check for incompatible licenses in locale packages Joshua Watt
2024-10-18 21:59 ` [OE-core][PATCH 4/4] lib: package: Copy locale license Joshua Watt
2024-10-23 21:15 ` [OE-core][PATCH v2 0/4] Incompatible Licenses in Dynamic Packages Joshua Watt
2024-10-23 21:15   ` [OE-core][PATCH v2 1/4] classes-global/license: Move functions to library code Joshua Watt
2024-10-23 21:15   ` [OE-core][PATCH v2 2/4] lib: license: Move package license skip to library Joshua Watt
2024-10-23 23:38     ` Peter Kjellerstedt
     [not found]     ` <1801394EB093B1DD.16325@lists.openembedded.org>
2024-10-24  2:16       ` Peter Kjellerstedt
2024-10-23 21:15   ` Joshua Watt [this message]
2024-10-24  2:24     ` [OE-core][PATCH v2 3/4] lib: package: Check incompatible licenses at packaging time Peter Kjellerstedt
2024-10-24 10:02     ` Peter Kjellerstedt
2024-10-24 15:57       ` Joshua Watt
2024-10-23 21:15   ` [OE-core][PATCH v2 4/4] lib: package: Copy locale license Joshua Watt
2024-10-24 19:03   ` [OE-core][PATCH v3 0/4] Incompatible Licenses in Dynamic Packages Joshua Watt
2024-10-24 19:03     ` [OE-core][PATCH v3 1/4] classes-global/license: Move functions to library code Joshua Watt
2024-10-24 19:03     ` [OE-core][PATCH v3 2/4] lib: license: Move package license skip to library Joshua Watt
2024-10-24 19:03     ` [OE-core][PATCH v3 3/4] lib: package: Check incompatible licenses at packaging time Joshua Watt
2024-10-24 19:03     ` [OE-core][PATCH v3 4/4] lib: package: Copy locale license Joshua Watt

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=20241023212013.995247-4-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox