Skip to content

Enable usage of rust mirrors #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
frosch01 opened this issue Mar 12, 2025 · 0 comments
Open

Enable usage of rust mirrors #206

frosch01 opened this issue Mar 12, 2025 · 0 comments

Comments

@frosch01
Copy link

Hello,

this is actually a duplication of this ticket. There has never been a response to this ticket, so I assume the request was perhaps not precise enough. I will try to be more precise.

There can be reasons that there is a need for using a mirror of static.rust-lang.org. Inside meta-rust-bin, there is the variable RUST_BASE_URI which is defined in classes/rust_bin-common.bbclass. This variable is set with the := assignment which does no allow the variable to be pre-defined, e.g. at local.conf. bbappending is also not possible for bbclasses. By simply changing the assignment into ?= would do the trick. E.g.:

-RUST_BASE_URI := "https://static.rust-lang.org"
+RUST_BASE_URI ?= "https://static.rust-lang.org"

A 2nd change that is required to use RUST_BASE_URI everywhere. Currently, this variable is not used inside the recipes-devtools/rust/cargo-bin-cross_.bb recipes. Instead, the string "https://static.rust-lang.org" is used. E.g.

 def cargo_url(triple):
     URLS = {
-        "aarch64-unknown-linux-gnu": "https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-aarch64-unknown-linux-gnu.tar.gz",
-        "arm-unknown-linux-gnueabi": "https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-arm-unknown-linux-gnueabi.tar.gz",
-        "arm-unknown-linux-gnueabihf": "https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-arm-unknown-linux-gnueabihf.tar.gz",
-        "armv7-unknown-linux-gnueabihf": "https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-armv7-unknown-linux-gnueabihf.tar.gz",
-        "i686-unknown-linux-gnu": "https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-i686-unknown-linux-gnu.tar.gz",
-        "x86_64-unknown-linux-gnu": "https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-x86_64-unknown-linux-gnu.tar.gz",
+        "aarch64-unknown-linux-gnu": "${RUST_BASE_URI}/dist/2024-06-13/cargo-1.79.0-aarch64-unknown-linux-gnu.tar.gz",
+        "arm-unknown-linux-gnueabi": "${RUST_BASE_URI}/dist/2024-06-13/cargo-1.79.0-arm-unknown-linux-gnueabi.tar.gz",
+        "arm-unknown-linux-gnueabihf": "${RUST_BASE_URI}/dist/2024-06-13/cargo-1.79.0-arm-unknown-linux-gnueabihf.tar.gz",
+        "armv7-unknown-linux-gnueabihf": "${RUST_BASE_URI}/dist/2024-06-13/cargo-1.79.0-armv7-unknown-linux-gnueabihf.tar.gz",
+        "i686-unknown-linux-gnu": "${RUST_BASE_URI}/dist/2024-06-13/cargo-1.79.0-i686-unknown-linux-gnu.tar.gz",
+        "x86_64-unknown-linux-gnu": "${RUST_BASE_URI}/dist/2024-06-13/cargo-1.79.0-x86_64-unknown-linux-gnu.tar.gz",
     }

My 3rd demand comes into play when looking into the internal structure of the static.rust-lang.org repository. The URI for fetching artifacts is actually https://static.rust-lang.org/dist/. However, the files are found one level above, sorting artifacts by release dates. The delegation happens with the channel.toml files. If these channel.toml configurations are not recognized by a mirror, the files are not found.

For cargo downloading, the URI is actually containing these paths currently, so there things are working as expected. E.g.

$ bitbake -e cargo-bin-cross-x86_64 | grep ^SRC_URI
SRC_URI="https://static.rust-lang.org/dist/2024-06-13/cargo-1.79.0-x86_64-unknown-linux-gnu.tar.gz;md5sum=4a89780dc045b3fe221b4507ed63bfd3;sha256sum=d394298cfd4a51eaf85607cceb33a1d83cbe723365687d7055f4b68e065a72fe;downloadname=cargo-bin-cross-x86_64-1.79.0-x86_64-unknown-linux-gnu.tar.gz"

For rust downloading, the URI is lacking the date directory level, so there downloading fails. E.g.

$ bitbake -e rust-bin-cross-x86_64 | grep ^SRC_URI
SRC_URI="https://static.rust-lang.org/dist/rustc-1.79.0-x86_64-unknown-linux-gnu.tar.gz;md5sum=a0cac6f2de82fbf573c7706a766466e6;sha256sum=36e59d225cc4c35f4d63c276c94a5e5cba5c8083275c3990ae7cae6842f9109f https://static.rust-lang.org/dist/rust-std-1.79.0-x86_64-unknown-linux-gnu.tar.gz;md5sum=489611626b01cf4f882df76e3cfe7306;sha256sum=037906a372ec87f8fd7ab45efa645bcc4fbf981f534e31534c6f16ce628fddb6;subdir=rust-std https://static.rust-lang.org/dist/rust-std-1.79.0-x86_64-unknown-linux-gnu.tar.gz;md5sum=489611626b01cf4f882df76e3cfe7306;sha256sum=037906a372ec87f8fd7ab45efa645bcc4fbf981f534e31534c6f16ce628fddb6;subdir=rust-std"

The demand is to also add the date level to the rust URI to be more robust when not having a "real" rust mirror in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant