rust-embedded / rust-embedded/meta-rust-bin

Enable usage of rust mirrors

Open
#206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
BitBake
Stars
124
Forks
92
Avg merge
6h 54m
Merged PRs (30d)
2

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with classes/rust_bin-common.bbclass and the recipes-devtools/rust/cargo-bin-cross_.bb recipes, then inspect the rust-bin-cross recipe SRC_URI values using the bitbake -e commands shown. Verify that RUST_BASE_URI can be overridden, cargo and rust downloads use it, and rust URLs include the date directory required by mirrors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.