create-spdx: Fix key errors in do_create_runtime_spdx

Message ID 20211118000402.17589-1-abeltran@linux.microsoft.com
State Accepted, archived
Commit 140ce5ef5e8f10251091660e3ef76f315f409076
Headers show
Series create-spdx: Fix key errors in do_create_runtime_spdx | expand

Commit Message

Andres Beltran Nov. 18, 2021, 12:04 a.m. UTC
Currently, the do_create_runtime_spdx task fails with a Key Error if a
dependency is not contained in the package providers dictionary. Add a
check before using "dep" as a key in "providers".

Signed-off-by: Andres Beltran <abeltran@linux.microsoft.com>
---
 meta/classes/create-spdx.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
index c85a11595f..601a928996 100644
--- a/meta/classes/create-spdx.bbclass
+++ b/meta/classes/create-spdx.bbclass
@@ -678,6 +678,9 @@  python do_create_runtime_spdx() {
                 if dep in seen_deps:
                     continue
 
+                if dep not in providers:
+                    continue
+
                 dep = providers[dep]
 
                 if not oe.packagedata.packaged(dep, localdata):