summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/spdx_common.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-02 10:26:28 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-07 15:47:15 +0100
commita211f058cc3a5673d8e686b9e6e8fcf1e7cd972b (patch)
treea4f9de9e79332521a477df5fc56e8cbc15a1a6b7 /meta/lib/oe/spdx_common.py
parent7355465f9ead0c4969adbfc167d7f29d0ca1fc11 (diff)
downloadpoky-a211f058cc3a5673d8e686b9e6e8fcf1e7cd972b.tar.gz
sdpx: Avoid loading of SPDX_LICENSE_DATA into global config
Loading a load of json files into a memory structure and stashing in a bitbake variable is relatively anti-social making bitbake -e output hard to read for example as well as other potential performance issues. Defer loading of that data until it is actually needed/used in a funciton where it is now passed as a parameter. (From OE-Core rev: 6f21cc9598178288784ff451ab3c40b174c0ef3e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/spdx_common.py')
-rw-r--r--meta/lib/oe/spdx_common.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/meta/lib/oe/spdx_common.py b/meta/lib/oe/spdx_common.py
index f23100fe03..dfe90f96cf 100644
--- a/meta/lib/oe/spdx_common.py
+++ b/meta/lib/oe/spdx_common.py
@@ -42,14 +42,13 @@ def is_work_shared_spdx(d):
42 42
43 43
44def load_spdx_license_data(d): 44def load_spdx_license_data(d):
45 if d.getVar("SPDX_LICENSE_DATA"):
46 return
47 45
48 with open(d.getVar("SPDX_LICENSES"), "r") as f: 46 with open(d.getVar("SPDX_LICENSES"), "r") as f:
49 data = json.load(f) 47 data = json.load(f)
50 # Transform the license array to a dictionary 48 # Transform the license array to a dictionary
51 data["licenses"] = {l["licenseId"]: l for l in data["licenses"]} 49 data["licenses"] = {l["licenseId"]: l for l in data["licenses"]}
52 d.setVar("SPDX_LICENSE_DATA", data) 50
51 return data
53 52
54 53
55def process_sources(d): 54def process_sources(d):