simpleinfra
simpleinfra copied to clipboard
Refactor scripts to set up Rust on dev desktops
The scripts to set up Rust for a user on the dev desktops have been refactored for a better onboarding experience and error handling. The init script installs rustup now, and can be extended in the future to also set the user's git username and email.
For users who want to set up their own Rust toolchain, the setup_rust script clones their fork of the rust-lang/rust repository, compiles it, and links the build artifacts. This is optional, however, and not required if users want to use the dev desktop to work with different repositories.
I missed that the worktree scripts are calling setup_rustup.sh, which will now do a bunch more work. Will take a look at this tomorrow. 🤦♂️
The init and setup_rust scripts have been tested on the new instances and seem to work fine. :+1:
@jdno have you seen https://github.com/rust-lang/simpleinfra/pull/132#discussion_r1000658197 ?
@jyn514 I've updated the link_rust script with the changes we talked about yesterday. Tested them in a virtual machine, and everything seems to work fine. 👍
Looks great, thanks! My last comment is that https://github.com/rust-lang/rust/pull/103286 is landing soon - we may want to either wait until it lands so we can use the new sysroot names unconditionally, or use version detection so this doesn't silently break.
Thanks for the heads-up, @jyn514! What's the best way to detect the version? Can we somehow check the bootstrap version, or should we just go for rustc --version?
@jdno try this:
; grep 'pub const VERSION' src/bootstrap/lib.rs | grep -o '[0-9]*'
2
I can add a comment to bootstrap saying to keep the version in the same file. Major version 3 is the one that's going to change the sysroot paths; there's not yet a way to test it unless you want to run your script against a checkout of https://github.com/rust-lang/rust/pull/103286.
Looking at the compiler version won't help because it just show 1.66-dev; theoretically you could look at the git hash but that will only work once https://github.com/rust-lang/rust/pull/103286 has landed.
I've added the grep command and an if block to handle the two different versions. Also rebased the branch to resolve a merge conflict after merging #110.
Thanks so much for the help, @jyn514! <3