| Summary: | Crate fetcher hardcodes URLs | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] BitBake | Reporter: | Ross Burton <ross.burton> | ||||
| Component: | bitbake | Assignee: | Minsung Cho <ms98.cho> | ||||
| Status: | NEW --- | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | Medium | CC: | ms98.cho, paul, poky.bs.watcher, poky.watcher, randy.macleod, sundeep.kokkonda | ||||
| Version: | 6.0 | ||||||
| Target Milestone: | 6.1 | ||||||
| Hardware: | x86 | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | Yes (doc changes required) | |||||
| Attachments: |
|
||||||
|
Description
Ross Burton
2026-05-01 12:06:12 UTC
As an example to compare to, for crates published on my Forgejo instance, https://forge.betafive.net/api/packages/pub/cargo/config.json contains: { "dl": "https://forge.betafive.net/api/packages/pub/cargo/api/v1/crates", "api": "https://forge.betafive.net/api/packages/pub/cargo", "auth-required": false } A nice improvement but not urgent. Created attachment 5215 [details]
fetch2/crate: support configurable registry and index URLs
This adds CRATE_REGISTRY_URL[host] and CRATE_INDEX_URL[host] support with {crate}, {version}, and {index_path} placeholders. The default crates.io behavior is preserved, while API-style custom registries and custom sparse registries are supported. Sparse registries are tracked explicitly so latest-version checks use the Cargo sparse index parser.
Verification:
- BB_SKIP_NETTESTS=yes python3 -m unittest bb.tests.fetch.CrateTest
- Ran 12 tests, OK (5 skipped)
- crates.io regression tests passed
- python3 -m py_compile lib/bb/fetch2/crate.py lib/bb/tests/fetch.py
- git diff --check HEAD
Also added a dummy local sparse registry test that serves a generated crate archive and sparse index via HTTPService, then verifies latest-version lookup, checksum validation, download, and unpack.
Hi Minsung Cho, Thanks for taking a look at this and attaching a patch! Are you able to send this to the bitbake-devel@lists.openembedded.org mailing list via `git send-email` or `b4 send` (https://b4.docs.kernel.org/en/latest/contributor/send.html, does not need a working SMTP server)? Can we namespace the variables with BB_ prefixes? i.e. BB_CRATE_REGISTRY_URL and BB_CRATE_INDEX_URL. Thanks for reviewing it so quick! I sent the new patch to the mailing list. Changes from the original submission: - Renamed the new variables to use the requested BB_ namespace. - BB_CRATE_REGISTRY_URL[host] - BB_CRATE_INDEX_URL[host] |