diff mbox series

[v2,1/3] lib/oe/license: factor out incompatible_license_check_needed()

Message ID 20261117120155.3986876-2-sean@geanix.com
State New
Headers show
Series license_image: don't apply INCOMPATIBLE_LICENSE to SDK host tools | expand

Commit Message

Sean Nyekjaer Nov. 17, 2026, 12:01 p.m. UTC
Move the check for recipes INCOMPATIBLE_LICENSE does not apply to
(native, nativesdk, cross, cross-canadian and gcc-source) out of
skip_incompatible_package_licenses() into its own function, so it can
be reused when checking packages at image/SDK creation time. No
functional change.

AI-Generated: Claude Opus 5.5 (Claude Code)
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
 meta/lib/oe/license.py | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index e2a2bcc47d..035311d469 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -561,23 +561,28 @@  def filter_pkg_license_list(pkg, lst):
 
     return pkg_lst
 
+def incompatible_license_check_needed(d, pn):
+    """
+    Return False for recipes that INCOMPATIBLE_LICENSE does not apply to:
+    native, nativesdk, cross and cross-canadian recipes, and gcc-source.
+    """
+    if pn.startswith("nativesdk-") or pn.startswith("gcc-source-"):
+        return False
+    for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}",
+            "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}",
+            "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]:
+        if pn.endswith(d.expand(t)):
+            return False
+    return True
+
 def skip_incompatible_package_licenses(d, pkgs):
     if not pkgs:
         return {}
 
     pn = d.getVar("PN")
 
-    check_license = False if pn.startswith("nativesdk-") else True
-    for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}",
-            "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}",
-            "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]:
-        if pn.endswith(d.expand(t)):
-            check_license = False
-    if pn.startswith("gcc-source-"):
-        check_license = False
-
     bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
-    if not check_license or not bad_licenses:
+    if not incompatible_license_check_needed(d, pn) or not bad_licenses:
         return {}
 
     bad_licenses = expand_wildcard_licenses(d, bad_licenses)