Skip to content
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

option to install toolchain version IFF it has certain components #1501

Closed
matthiaskrgr opened this issue Sep 5, 2018 · 10 comments
Closed

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Sep 5, 2018

When dealing with continuous like travis, I can specify a toolchain I want to have

language: rust
rust:
  - beta
  - nightly

but not what components (rustfmt clippy) I want to install.
This means if I want to use clippy or rustfmt, I have to manually rustup component add it or, if the current nightly version does not ship it, try to somehow install it myself and hope it builds with the current rustc nightly.
It would be great to have some kind of option "install the lastest nightly that has components x and y available" which entails potentially downgrading to a earlier nightly if the current nightly does not ship the components but the later nightly does.

Perhaps rustup install nightly --needed-components=clippy,rustfmt or something like that.

@RalfJung
Copy link
Member

RalfJung commented Jun 4, 2019

The title of this issue is misleading... it talks about updating when the issue is about installation.

Could someone rename it appropriately? I think this is the better alternative to #1602 and #1676.

@matthiaskrgr
Copy link
Member Author

@RalfJung updated!

@najamelan
Copy link

najamelan commented Aug 21, 2019

@RalfJung

it talks about updating when the issue is about installation

It would be nice if rustup update did the same thing though. Eg. get you the latest nightly that has your components.

@RalfJung
Copy link
Member

@najamelan your comment consists only of quotes, looks like a formatting issue?

get you the latest nightly that has your components.

AFAIK if you have a component installed, rustup will only upgrade to nighties that have that component.

@najamelan
Copy link

@RalfJung Sorry, it needed a white line to work there.

AFAIK if you have a component installed, rustup will only upgrade to nighties that have that component.

So the point is, if I have a nightly that is one month old, with components, and I run rustup update, if todays nightly doesn't have the components, it won't update anything at all, even if yesterdays nightly had the required components.

So I think lots of people would like for rustup to update to the latest nightly that has that component.

The issue is very similar for installs and updates, so I think both should considered together when trying to solve this.

jonhoo added a commit to jonhoo/rustup.rs that referenced this issue Sep 16, 2019
Previously, if the user had components installed on `nightly` which were
not available for the latest nightly, `rustup update` would not update
the user's nightly at all. With this patch, rustup will try
progressively older nightlies until it finds a nightly that supports all
the components the user has installed for their current nightly.

Fixes rust-lang#1628.
Makes progress towards rust-lang#1501.
Fixes the underlying issue in rust-lang#1676.
jonhoo added a commit to jonhoo/rustup.rs that referenced this issue Sep 16, 2019
Previously, if the user had components installed on `nightly` which were
not available for the latest nightly, `rustup update` would not update
the user's nightly at all. With this patch, rustup will try
progressively older nightlies until it finds a nightly that supports all
the components the user has installed for their current nightly.

Fixes rust-lang#1628.
Makes progress towards rust-lang#1501.
Fixes the underlying issue in rust-lang#1676.
@jonhoo
Copy link
Contributor

jonhoo commented Sep 16, 2019

@najamelan that will be the behavior with #1997 :)

jonhoo added a commit to jonhoo/rustup.rs that referenced this issue Sep 17, 2019
Previously, if the user had components installed on `nightly` which were
not available for the latest nightly, `rustup update` would not update
the user's nightly at all. With this patch, rustup will try
progressively older nightlies until it finds a nightly that supports all
the components the user has installed for their current nightly.

Fixes rust-lang#1628.
Makes progress towards rust-lang#1501.
Fixes the underlying issue in rust-lang#1676.
@kinnison
Copy link
Contributor

I believe this is covered by Rustup 1.20

@AaronKutch
Copy link

Has this issue not really been fixed, or am I missing something? Right now, I am trying to add clippy to the CI of compiler-builtins. The GitHub Actions CI has to start by installing a fresh Rust with no components. Because the crate uses nightly features, we need the nightly version of clippy, but the component might not exist. It happens to exist right now, but my local rustup update does not update all the way to the same version of clippy that the CI uses (because of lack of other components), and I have already run into new lint issues that I can't readily test. This issue mentions rustup install nightly --needed-components=clippy,rustfmt, but that isn't what #1997 implements, and #1997 is unable to solve what rustup install nightly --needed-components=clippy,rustfmt could solve.

@RalfJung
Copy link
Member

RalfJung commented Apr 2, 2021

For nightly toolchains, the only approach I know of is to do what Miri also does when you want to run it in some project's CI:

MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
rustup set profile minimal
rustup default "$MIRI_NIGHTLY"
rustup component add miri

cargo miri test

Not sure what the nicest way is to put that into GHA.

Files like https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri exist for all tools, e.g. https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy.

@AaronKutch
Copy link

Thanks, I found the magic lines to be:

rustup set profile minimal && rustup default "nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)" && rustup component add clippy
cargo clippy -- -D clippy::all

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

6 participants