simpleinfra icon indicating copy to clipboard operation
simpleinfra copied to clipboard

Refactor scripts to set up Rust on dev desktops

Open jdno opened this issue 3 years ago • 3 comments

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.

jdno avatar Oct 10 '22 16:10 jdno

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. 🤦‍♂️

jdno avatar Oct 10 '22 16:10 jdno

The init and setup_rust scripts have been tested on the new instances and seem to work fine. :+1:

jdno avatar Oct 18 '22 09:10 jdno

@jdno have you seen https://github.com/rust-lang/simpleinfra/pull/132#discussion_r1000658197 ?

jyn514 avatar Oct 21 '22 14:10 jyn514

@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. 👍

jdno avatar Oct 27 '22 12:10 jdno

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.

jyn514 avatar Oct 27 '22 13:10 jyn514

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 avatar Nov 01 '22 14:11 jdno

@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.

jyn514 avatar Nov 01 '22 14:11 jyn514

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.

jdno avatar Nov 02 '22 08:11 jdno

Thanks so much for the help, @jyn514! <3

jdno avatar Nov 02 '22 10:11 jdno