license: fix list_licenses() crash on CLOSED and empty licenses
PATCH 1/1 license: fix list_licenses() crash on CLOSED and empty licenses
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().
--- meta/lib/oe/license.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta/lib/oe/license.py +3 -1
@@ -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):
Signature · 1 line
2.47.3
Quoted 6 lines · Dmitry Baryshkov via lists.openembedded.org
oe.license.list_licenses()passes the result ofparse_legacy_license()straight intowalk_license(), which unconditionally iterates node.children. For LICENSE = "CLOSED" (and for an empty license string)parse_legacy_license()returns None, sowalk_license(None)dereferences None.children and abortsdo_package_qawith:
Quoted 8 lines
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().
LGTM, thanks.
Quoted 38 lines
Fixes e9d424738d6f ("classes/conf/lib: Parse LICENSE as SPDX Expression")Assisted-by Claude:claude-opus-4-8Signed-off-by Dmitry Baryshkov <[email protected]>--- meta/lib/oe/license.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)meta/lib/oe/license.py +3
-2@@ -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/3616693
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-