Tool:rustup
| Shared Rust installation for Toolforge | |
|---|---|
| Description | Maintains a shared rustup toolchain for other tools to use |
| Keywords | rustup, rust |
| Author(s) | The Rust Project |
| Maintainer(s) | Legoktm, APerson, Magnus Manske, Erutuon (View all) |
| Source code | https://github.com/rust-lang/rustup/ |
| License | Apache License 2.0 |
This tool maintains and manages a shared rustup installation for use on Toolforge. To use it in your tool, add the following to ~/.profile:
."/data/project/rustup/rustup/.cargo/env" exportRUSTUP_HOME=/data/project/rustup/rustup/.rustup
After logging out and in again, try running rustup show, you should see something like:
Default host: x86_64-unknown-linux-gnu rustup home: /data/project/rustup/rustup/.rustup installed toolchains -------------------- stable-x86_64-unknown-linux-gnu (default) 1.55-x86_64-unknown-linux-gnu 1.56-x86_64-unknown-linux-gnu active toolchain ---------------- stable-x86_64-unknown-linux-gnu (default) rustc 1.56.1 (59eed8a2a 2021年11月01日)
If you had previously installed rustup in the tool itself, you should make sure to uninstall it first, usually rustup self uninstall will do the trick.
Using a different Rust version
By default, you will follow the "stable" channel, which will track the latest stable Rust version within a day of its release. If you want to track a specific minor Rust version, like 1.55, you can either specify the version in each command you run, e.g. cargo +1.55 build --release or you can create a rust-toolchain.toml in your project.
All stable Rust versions since 1.55 should be available. If you need something older, please ask one of the maintainers to install it for you.
If you try setting a rustup override or using rustup default, it will not work because of how the shared installation is set up. Sorry.
Extra Rust utilities
For convenience we also install the latest version (within a day of their releases) of some utilities that are written in Rust:
The same setup instructions will make these utilities available in your $PATH. If you would like something else installed, please ask one of the maintainers to add it for you.
Implementation details
The installation was set up by creating a new directory in /data/project/rustup, chmod -R 755ing it so only that tool can modify it, then running:
exportRUSTUP_HOME=/data/project/rustup/rustup/.rustup exportCARGO_HOME=/data/project/rustup/rustup/.cargo curlhttps://sh.rustup.rs-sSf|sh-s----profileminimal
The update script runs on a daily cron:
#!/bin/bash # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2021 Kunal Mehta set-euxopipefail # Update existing toolchains rustupupdate # Add the latest minor Rust toolchain exportLATEST_RUST=$(curl'https://release-monitoring.org/api/v2/versions/?project_id=7635'|jq'.latest_version'-r|cut-c-4) rustuptoolchaininstall$LATEST_RUST # https://github.com/rust-lang/cargo/issues/4350#issuecomment-340215811 exportTMPDIR=/data/project/rustup/tmp # Install popular tools cargoinstallripgrep cargoinstallfd-find cargoinstalltrunk--locked
--- -name:update command:./update.sh image:tf-python39 schedule:"12***" emails:onfailure mem:3G