oe.license.list_licenses() passes the result of parse_legacy_license()
straight into walk_license(), which unconditionally iterates
node.children. For LICENSE = "CLOSED" (and for an empty license string)
parse_legacy_license() returns None, so walk_license(None) dereferences
None.children and aborts do_package_qa with:

  AttributeError: 'NoneType' object has no attribute 'children'

This breaks packaging for every CLOSED-licensed recipe reaching the
obsolete-license QA check.

Guard the walk against a None node, mirroring the existing "if node:"
check in the neighbouring apply_pkg_license_exclusion().

Fixes: e9d424738d6f ("classes/conf/lib: Parse LICENSE as SPDX Expression")
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Dmitry Baryshkov <[email protected]>
---
 meta/lib/oe/license.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index a1dce143dd20..adcfc827cfc0 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -235,7 +235,9 @@ def list_licenses(licensestr, d):
         for child in node.children:
             walk_license(child)
 
-    walk_license(parse_legacy_license(d, licensestr))
+    node = parse_legacy_license(d, licensestr)
+    if node:
+        walk_license(node)
     return set(licenses)
 
 def return_spdx(d, license):
-- 
2.47.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#241552): 
https://lists.openembedded.org/g/openembedded-core/message/241552
Mute This Topic: https://lists.openembedded.org/mt/120378577/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

  • [OE-core] [PATCH] license: fix... Dmitry Baryshkov via lists.openembedded.org

Reply via email to