| Summary: | crate://crates.io is not a valid download_location for SPDX 2.2 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Billie Alsup <balsup> | ||||
| Component: | oe-core other | Assignee: | Jayasurya Maganuru <Maganuru.Jayasurya> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Medium+ | CC: | ccasciato, JPEWhacker, Maganuru.Jayasurya, randy.macleod, sundeep.kokkonda | ||||
| Version: | 5.0.15 | ||||||
| Target Milestone: | 5.3 M4 | ||||||
| Hardware: | All | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | Don't know | |||||
| Attachments: |
|
||||||
|
Description
Billie Alsup
2025-06-18 04:36:25 UTC
I presume create-spdx class should massage the url similar to how the fetcher does it, e.g.
if host == 'crates.io':
host = 'crates.io/api/v1/crates'
ud.url = "https://%s/%s/%s/download" % (host, name, version)
Should the fetcher itself support a function to translate a given (fetcher) URL into a list of download locations? This problem first presented itself with gitsm, and there is a translation in fetch_data_to_uri (although it seems to simply ignore the submodules). There are bound to be fetchers in the future that do their own thing, so supporting an optional fetcher method to return a list of download locations (or perhaps mappings between download locations and sets of downloaded files) would seem to make sense, rather than putting exceptions into spdx_common.py. Internally spdx has mappings of varioius URLS. Rust wasn't in dunfell so it's likely that there's just a missing mapping for crates.io. So yes, we should have a translation function as Billie suggested. Can you do that Billie ? -- YP bug triage Created attachment 5124 [details]
Workaround for crate fetcher URLs being invalid SPDX URLs
Let me get the required approvals here, and then I'll take a look at a long term solution. In the meantime, I've attached our scarthgap workaround. Hi Billie, Thanks for the patch / workaround. It might help someone who happens to read this defect. I'll move this bug to accepted and hopefully it won't take too long for you to get local approval to contribute to Yocto so the patch can be merged to master and then back-ported as needed. I am still in the waiting for business approval state (which is unlikely to come until I finish some internal projects). The given workaround was sufficient for us to proceed, and deprioritized work to have a generic solution going forward. Joshua, Should Sundeep have someone submit the work-around or is there a better approach? Yes, the munging of the URI is correct for crates, but please do it in the fetch_data_to_uri function in spdx_common.py. Ideally, the actual URI comes from the fetcher and we just need to know to use that for crates (or others) See above comment (In reply to Joshua Watt from comment #10) > See above comment Hi Joshua, I've made the equivalent changes of the workaround, to fetch_data_to_uri function of spdx_common.py and manually verified the generated spdx.json (for the recipe python3-bcrypt). The software_downloadLocation is now correctly set to a valid URL, e.g.: "software_downloadLocation": "https://crates.io/api/v1/crates/windows_i686_gnu/0.48.5/download" instead of the invalid crate://crates.io/... format previously used for Rust crates. Should I be validating the spdx.json output using any specific tool before sending a patch to poky master? Or is this manual check sufficient to move forward? |