git: bc18f00c490c - main - bsd.sites.mk: use static CDN to download rust crates
Date: Fri, 11 Sep 2026 14:01:44 UTC
The branch main has been updated by siva:
URL: https://cgit.FreeBSD.org/ports/commit/?id=bc18f00c490cd54dfe38e2d94d8c4feae2815f0f
commit bc18f00c490cd54dfe38e2d94d8c4feae2815f0f
Author: Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-09-11 14:00:05 +0000
Commit: Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-09-11 14:01:06 +0000
bsd.sites.mk: use static CDN to download rust crates
static.crates.io is the recommended upstream download
path. This avoids "403 Forbidden" rate limiting results
when trying to download crates too fast. This also
seems to improve download speeds/latency.
As per https://crates.io/data-access#crate-content,
> Crates can be downloaded directly from the crates.io CDN
> [...]
> No rate limits apply to static.crates.io at present.
And as per https://crates.io/data-access#api,
> you are welcome to use the crates.io API provided you abide by the following limits:
> * A maximum of 1 request per second, and
> * A user-agent header that identifies your application.
Reviewed by: mikael
Differential Revision: https://reviews.freebsd.org/D59575
---
Mk/Uses/cargo.mk | 2 +-
Mk/bsd.sites.mk | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index be5ce0cd6e13..0307b308a286 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -68,7 +68,7 @@ _CARGO_CRATES:= ${_CARGO_CRATES:C/^([-_a-zA-Z0-9]+)-([0-9].*)/\0 \1 \2/}
. for _index _crate _name _version in ${_CARGO_CRATES}
# Resolving CRATESIO alias is very inefficient with many MASTER_SITES, consume MASTER_SITE_CRATESIO directly
-MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_name}/${_version},:S,$,:_cargo_${_index},}
+MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_name}/${_crate}${CARGO_CRATE_EXT},:S,$,:_cargo_${_index},}
DISTFILES+= ${CARGO_DIST_SUBDIR}/${_crate}${CARGO_CRATE_EXT}:_cargo_${_index}
# Provide pointer to the crate's extraction dir
diff --git a/Mk/bsd.sites.mk b/Mk/bsd.sites.mk
index adbb11a061c3..80d3e281975b 100644
--- a/Mk/bsd.sites.mk
+++ b/Mk/bsd.sites.mk
@@ -106,7 +106,7 @@ MASTER_SITE_CRAN_ARCHIVE+= ${MASTER_SITE_CRAN:S,$,Archive/${PORTNAME}/,}
.endif
.if !defined(IGNORE_MASTER_SITE_CRATESIO)
-MASTER_SITE_CRATESIO+= https://crates.io/api/v1/crates/%SUBDIR%/download?dummy=/
+MASTER_SITE_CRATESIO+= https://static.crates.io/crates/%SUBDIR%?dummy=/
.endif
.if !defined(IGNORE_MASTER_SITE_DEBIAN)