All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] crates.io data access policy
@ 2026-04-27 13:51 Johan Anderholm
  2026-04-27 13:51 ` [PATCH 1/1] fetch2/crate: use CDN for fetching crates Johan Anderholm
  2026-04-27 17:35 ` [bitbake-devel] [PATCH 0/1] crates.io data access policy Quentin Schulz
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Anderholm @ 2026-04-27 13:51 UTC (permalink / raw)
  To: bitbake-devel

It appears that the crate fetcher does not adhere to the data access policy
of crates.io as is described here:

https://crates.io/data-access#api

Namely the part about adding a user-agent identifying the application and
information on how to reach the project in case of issues.

Also users are requested to use the CDN instead of the download API, as that
does not have a 1 request per second limit:

https://github.com/rust-lang/crates.io/issues/13482#issuecomment-4304855751

This patch addresses the request to use a CDN and seems to fix a recent
breakage of the crate fetcher. It does not address the part about a user-agent
since I do not know how to do that, and I do not know what to put in it anyway.

Johan Anderholm (1):
  fetch2/crate: use CDN for fetching crates

 lib/bb/fetch2/crate.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] fetch2/crate: use CDN for fetching crates
  2026-04-27 13:51 [PATCH 0/1] crates.io data access policy Johan Anderholm
@ 2026-04-27 13:51 ` Johan Anderholm
  2026-04-27 17:35 ` [bitbake-devel] [PATCH 0/1] crates.io data access policy Quentin Schulz
  1 sibling, 0 replies; 4+ messages in thread
From: Johan Anderholm @ 2026-04-27 13:51 UTC (permalink / raw)
  To: bitbake-devel

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/
Signed-off-by: Johan Anderholm <johanam@axis.com>
---
 lib/bb/fetch2/crate.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch2/crate.py
index e611736f0..2d3078899 100644
--- a/lib/bb/fetch2/crate.py
+++ b/lib/bb/fetch2/crate.py
@@ -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.versionsurl = "https://%s/%s/versions" % (host, name)
         ud.parm['downloadfilename'] = "%s-%s.crate" % (name, version)
         if 'name' not in ud.parm:
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [bitbake-devel] [PATCH 0/1] crates.io data access policy
  2026-04-27 13:51 [PATCH 0/1] crates.io data access policy Johan Anderholm
  2026-04-27 13:51 ` [PATCH 1/1] fetch2/crate: use CDN for fetching crates Johan Anderholm
@ 2026-04-27 17:35 ` Quentin Schulz
  2026-04-27 20:25   ` Ross Burton
  1 sibling, 1 reply; 4+ messages in thread
From: Quentin Schulz @ 2026-04-27 17:35 UTC (permalink / raw)
  To: johan.anderholm, bitbake-devel

Hi Johan,

On 4/27/26 3:51 PM, Johan Anderholm via lists.openembedded.org wrote:
> [You don't often get email from johan.anderholm=axis.com@lists.openembedded.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> It appears that the crate fetcher does not adhere to the data access policy
> of crates.io as is described here:
> 
> https://crates.io/data-access#api
> 
> Namely the part about adding a user-agent identifying the application and
> information on how to reach the project in case of issues.
> 
> Also users are requested to use the CDN instead of the download API, as that
> does not have a 1 request per second limit:
> 
> https://github.com/rust-lang/crates.io/issues/13482#issuecomment-4304855751
> 
> This patch addresses the request to use a CDN and seems to fix a recent
> breakage of the crate fetcher. It does not address the part about a user-agent
> since I do not know how to do that, and I do not know what to put in it anyway.
> 

The crate fetcher is derived from the wget fetch method which does seem 
to implement a UA reporting bitbake and its version, see 234f9e810494 
("fetch2/wget: set User-Agent to 'bitbake/version' in checkstatus()"). 
The best thing would be to try yourself (I'm assuming having a webserver 
you control and change the fetcher to use your local webserver (or 
possibly even setting up a PREMIRRORS for crates)).

Cheers,
Quentin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bitbake-devel] [PATCH 0/1] crates.io data access policy
  2026-04-27 17:35 ` [bitbake-devel] [PATCH 0/1] crates.io data access policy Quentin Schulz
@ 2026-04-27 20:25   ` Ross Burton
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2026-04-27 20:25 UTC (permalink / raw)
  To: quentin.schulz@cherry.de
  Cc: johan.anderholm@axis.com, bitbake-devel@lists.openembedded.org

On 27 Apr 2026, at 18:35, Quentin Schulz via lists.openembedded.org <quentin.schulz=cherry.de@lists.openembedded.org> wrote:
> 
> The crate fetcher is derived from the wget fetch method which does seem to implement a UA reporting bitbake and its version, see 234f9e810494 ("fetch2/wget: set User-Agent to 'bitbake/version' in checkstatus()"). The best thing would be to try yourself (I'm assuming having a webserver you control and change the fetcher to use your local webserver (or possibly even setting up a PREMIRRORS for crates)).

That’s checkstatus, not the actual fetch.

Put this on the list of reasons why I dislike the wget fetcher: two entirely distinct codepaths.

Ross

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-27 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 13:51 [PATCH 0/1] crates.io data access policy Johan Anderholm
2026-04-27 13:51 ` [PATCH 1/1] fetch2/crate: use CDN for fetching crates Johan Anderholm
2026-04-27 17:35 ` [bitbake-devel] [PATCH 0/1] crates.io data access policy Quentin Schulz
2026-04-27 20:25   ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.