summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/spdx_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/spdx_common.py')
-rw-r--r--meta/lib/oe/spdx_common.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/meta/lib/oe/spdx_common.py b/meta/lib/oe/spdx_common.py
index dfe90f96cf..1ea55419ae 100644
--- a/meta/lib/oe/spdx_common.py
+++ b/meta/lib/oe/spdx_common.py
@@ -42,7 +42,6 @@ def is_work_shared_spdx(d):
42 42
43 43
44def load_spdx_license_data(d): 44def load_spdx_license_data(d):
45
46 with open(d.getVar("SPDX_LICENSES"), "r") as f: 45 with open(d.getVar("SPDX_LICENSES"), "r") as f:
47 data = json.load(f) 46 data = json.load(f)
48 # Transform the license array to a dictionary 47 # Transform the license array to a dictionary
@@ -225,3 +224,22 @@ def get_patched_src(d):
225 bb.utils.mkdirhier(spdx_workdir) 224 bb.utils.mkdirhier(spdx_workdir)
226 finally: 225 finally:
227 d.setVar("WORKDIR", workdir) 226 d.setVar("WORKDIR", workdir)
227
228
229def fetch_data_to_uri(fd, name):
230 """
231 Translates a bitbake FetchData to a string URI
232 """
233 uri = fd.type
234 # Map gitsm to git, since gitsm:// is not a valid URI protocol
235 if uri == "gitsm":
236 uri = "git"
237 proto = getattr(fd, "proto", None)
238 if proto is not None:
239 uri = uri + "+" + proto
240 uri = uri + "://" + fd.host + fd.path
241
242 if fd.method.supports_srcrev():
243 uri = uri + "@" + fd.revisions[name]
244
245 return uri