From b0134a0f1382a267f79ec881af916d641d41b235 Mon Sep 17 00:00:00 2001 From: Johan Anderholm Date: Mon, 27 Apr 2026 15:51:23 +0200 Subject: [PATCH] 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: a9f09b9e2f187f07a6f6dfd1caa3fd2f3d564a8a) Signed-off-by: Johan Anderholm Signed-off-by: Richard Purdie Signed-off-by: Paul Barker --- bitbake/lib/bb/fetch2/crate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/fetch2/crate.py b/bitbake/lib/bb/fetch2/crate.py index f4ddc782a9..2c10eabb5e 100644 --- a/bitbake/lib/bb/fetch2/crate.py +++ b/bitbake/lib/bb/fetch2/crate.py @@ -66,8 +66,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) ud.parm['name'] = name