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

Add DisplayVersion for rustup to registry on Windows. #3047

Merged
merged 1 commit into from
Aug 27, 2022

Conversation

jedieaston
Copy link
Contributor

@jedieaston jedieaston commented Jul 25, 2022

Hello! I'm a contributor to the Windows Package Manager Community Repository (microsoft/winget-pkgs), and we recently had an issue posted to that repo which revealed that Rustup was not publishing a DisplayVersion to Add and Remove Programs during its install (although it was posting its DisplayName).

The DisplayVersion is how winget and other tools determine when updates to software are needed, so it is highly recommended to set it whenever possible. This PR does just that, by making it so when Rustup is installed, it adds its version number to the registry alongside its name.

This is the most Rust I've ever written, so let me know if I did something wrong and I can fix it :)

Tested: manually by compiling a new version of Rustup and installing it in a VM. If this needs more strenuous tests, I'm happy to oblige.

Resolves: #3055

@LeonarddeR
Copy link

Thanks @jedieaston

I had exactly the same issue. My approach is slightly different:

    key.set_value("DisplayVersion", &common::version())
        .context("Failed to set display version")?;

Note that this sets the version in the form as outputted by rustup --version (i.e. it includes the commit hash and release date). As long as every new release changes either one of the major.minor.patch numbers that shouldn't be a problem.

@jedieaston
Copy link
Contributor Author

We prefer for there not to be extraneous information in the DisplayVersion outside of the number on the winget side, as it makes it easier to do comparisons for upgrades. If it is common to do multiple releases of Rustup under the same exact version number I can change it, but I think any stable releases would increment the CARGO_PKG_VERSION which is always just a number (at least, according to this).

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

Successfully merging this pull request may close these issues.

Register Rustup version in Windows registry for add/remove programs
3 participants