Skip to contentSkip to conversation

lib: spdx30_tasks: Use Fetch.expanded_urldata()

PATCH In review Joshua Watt 2 participants 2 messages Mar 7, 2025 – Mar 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: spdx30_tasks: Use Fetch.expanded_urldata()

Converts the SPDX 3 code to use the Fetch.expanded_urldata() API instead of iterating over all the SRC_URI entries manually. This will correctly report additional download URIs (e.g. submodules) in the SPDX data.

---
 meta/lib/oe/spdx30_tasks.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
meta/lib/oe/spdx30_tasks.py +4 -5
index e20bb0c86f3..f85fbeb0f0a 100644
@@ -349,12 +349,11 @@ def add_download_files(d, objset):
     urls = d.getVar("SRC_URI").split()
     fetch = bb.fetch2.Fetch(urls, d)
 
-    for download_idx, src_uri in enumerate(urls):
-        fd = fetch.ud[src_uri]
-
+    for download_idx, fd in enumerate(fetch.expanded_urldata()):
         for name in fd.names:
-            file_name = os.path.basename(fetch.localpath(src_uri))
-            if oe.patch.patch_path(src_uri, fetch, "", expand=False):
+            fd.setup_localpath(d)
+            file_name = os.path.basename(fd.localpath)
+            if oe.patch.patch_path(fd.url, fetch, "", expand=False):
                 primary_purpose = oe.spdx30.software_SoftwarePurpose.patch
             else:
                 primary_purpose = oe.spdx30.software_SoftwarePurpose.source
Signature · 1 line
2.47.1
#1 lore raw
Quoted 6 lines · Joshua Watt via lists.openembedded.org

Converts the SPDX 3 code to use the Fetch.expanded_urldata() API instead of iterating over all the SRC_URI entries manually. This will correctly report additional download URIs (e.g. submodules) in the SPDX data.

---

It looks like this is failing sometimes on submodules, I had a fail with meta-arm edk2-firmware recipe on the autobuilder:

Exception: bb.fetch2.FetchError: Fetcher failure for URL: 'gitsm://github.com/openssl/openssl;protocol=https;name=CryptoPkg/Library/OpensslLib/openssl;subpath=CryptoPkg/Library/OpensslLib/openssl;nobranch=1;lfs=True;bareclone=1;nobranch=1'. Please set a valid SRCREV for url ['SRCREV_CryptoPkg/Library/OpensslLib/openssl:pn-edk2-firmware', 'SRCREV_CryptoPkg/Library/OpensslLib/openssl', 'SRCREV:pn-edk2-firmware', 'SRCREV'] (possible key names are gitsm://github.com/openssl/openssl;protocol=https;name=CryptoPkg/Library/OpensslLib/openssl;subpath=CryptoPkg/Library/OpensslLib/openssl;nobranch=1;lfs=True;bareclone=1;nobranch=1, or use a ;rev=X URL parameter)

https://autobuilder.yoctoproject.org/valkyrie/#/builders/75/builds/1122

Yet I had another build succeed yesterday, also with this patch and on the same version of meta-arm:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/75/builds/1120

So I'm not really sure what is happening here.

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com