1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-07 16:59:22 +00:00

bitbake: fetch2/crate: use CDN for fetching crates

This avoids the 1 req/sec that the API has.

Reference: https://github.com/rust-lang/crates.io/issues/13482
Reference: https://blog.rust-lang.org/2024/03/11/crates-io-download-changes/
[RP: Tweak to apply to 2.8]
(Bitbake rev: b2404004135b669f8258c85c7b5aed4570a805c7)

Signed-off-by: Johan Anderholm <johanam@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Johan Anderholm
2026-04-27 15:51:23 +02:00
committed by Paul Barker
parent 3166007a93
commit d63005ebea
+4 -1
View File
@@ -68,8 +68,11 @@ class Crate(Wget):
# if using upstream just fix it up nicely
if host == 'crates.io':
host = 'crates.io/api/v1/crates'
cdn_host = 'static.crates.io/crates'
else:
cdn_host = host
ud.url = "https://%s/%s/%s/download" % (host, name, version)
ud.url = "https://%s/%s/%s/download" % (cdn_host, name, version)
ud.parm['downloadfilename'] = "%s-%s.crate" % (name, version)
if 'name' not in ud.parm:
ud.parm['name'] = '%s-%s' % (name, version)