Rustup: Setting to only check for a self-update during `rustup update`

Created on 26 Nov 2020  路  12Comments  路  Source: rust-lang/rustup

Describe the problem you are trying to solve
When testing the staging rustup release I had it "upgrade" back to the previous version when I ran rustup update nightly. This made me reconsider somehow aliasing in rustup update to include --no-self-update so that I could control when rustup itself updates.

Describe the solution you'd like
Something like rustup set update-self-update check-only that will check whether a self-update is available and report it, rather than installing it straight away.

Notes


E-mentor enhancement help wanted

Most helpful comment

Yep, that seems about what I was thinking.

All 12 comments

(I just noticed that rustup toolchain install also does a self-update, so update-self-update is probably a bad setting name, not sure what it could be called).

Such a setting could be very useful, it'd be nice to clean up a bunch of --no-self-update in our test suite for example. While not trivial, it shouldn't be too hard to add the setting and pipe it through to the requisite places in the CLI through our Cfg object.

@kinnison Can I working on this?

Sure you're welcome to work on it. Do you want to start by reading through how settings are passed around in the Cfg code, and then write a comment here with how you suggest you'll fix this?

Sure you're welcome to work on it. Do you want to start by reading through how settings are passed around in the Cfg code, and then write a comment here with how you suggest you'll fix this?

I will write my thoughts here after I read the code and go back to the code after you give your comments.

Sorry for the late reply.

I have read the code and I think the problem can be solved in a few steps.

  1. We need to add a self-update related setting item in Settings.
  2. We need to set the value in Cfg with the set subcommand support.
  3. Since the configuration can be read in Cfg, we can get the value from the cli (similar to get_default_host_triple) and check for it in the self-update mod and use it.

Do you think there is any problem?
Are there any other suggestions about this configuration item and its value name? @kinnison

@kinnison ping~

Sorry for the delay, I had a very busy work week.

I think your proposed approach is on-track. I'd suggest a setting name along the lines of auto-self-update with permitted values enabled (default if missing), disabled (does nothing unless manually running rustup self update), and check-only (which does a check for new versions to report when otherwise it would do an automatic self update).

@Nemo157 Would that solve your use-case?

Yep, that seems about what I was thinking.

Sorry, I forgot about this. I will take the time to add that feature recently.
cc: @jonhoo

@hi-rustin That would be amazing!

@rustbot claim

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KasMA1990 picture KasMA1990  路  3Comments

matthiaskrgr picture matthiaskrgr  路  3Comments

matthiaskrgr picture matthiaskrgr  路  3Comments

zwg-zero picture zwg-zero  路  3Comments

durka picture durka  路  3Comments