-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added argument to control whether to upgrade packages if they have "unknown" versions #1765
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denelon , does this seem like fine behavior to you? Nothing springs to mind as to why we wouldn't want it.
@lechacon , does there need to be additional work done for import? It does upgrade-like things but I don't think it uses this code path. If it would only attempt to upgrade in the event that a specific version was given in the import file, then I think it is probably ok to leave as is, even if that means attempting to re-install.
@@ -46,6 +47,7 @@ namespace AppInstaller::CLI | |||
Argument::ForType(Args::Type::AcceptSourceAgreements), | |||
Argument::ForType(Execution::Args::Type::CustomHeader), | |||
Argument{ "all", Argument::NoAlias, Args::Type::All, Resource::String::UpdateAllArgumentDescription, ArgumentType::Flag }, | |||
Argument{ "include-unknown", Argument::NoAlias, Args::Type::IncludeUnknown, Resource::String::IncludeUnknownArgumentDescription, ArgumentType::Flag } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denelon for argument name review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I find the argument name somewhat awkward for a single app: winget upgrade SomeApp --include-unknown
For upgrade --all
I understand it as "include apps with unknown version", but I don't quite get what we are "including" for a single app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if the user explicitly specifies an app, --include-unknown
would/should be redundant.
I also think winget upgrade AwesomePackage --all
would be similarly strange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current behavior is that upgrade <ID>
doesn’t upgrade a package if already at latest. I had the argument behavior stay the same so the expectation of winget not doing an upgrade unless it has to holds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Community opinion here; I would think that if I specify an ID, it should attempt to be upgraded even if the version is unknown. I would think that even if the version doesn't change, from a user perspective, an upgrade was at least attempted. It could be very confusing if the user knows there is an update, and they try to upgrade it only to be told that no applicable update was found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a message that prints:
PS C:\Users\easton> wingetdev upgrade GOG.Galaxy
This package's version number cannot be determined. To upgrade it anyway, add the argument --include-unknown to your previous command.
PS C:\Users\easton>
There was some discussion in the issue about whether or not there should be a setting to restore the current behavior (when in doubt, upgrade), but by default I think it should prompt the user to make a decision. The infinite reupgrading is causing more confusion than this is, IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I must have missed that. I would be fine with that approach, since it is clear and informative
Yes, there needs to be some work done for import as it doesn't use this code path. If there is no specific version in the file, I think import will try to update to the latest. Import does call |
The current behavior lists everything. This PR could be considered a breaking change. I'm leaning in the direction of agreeing to do this since most of the packages listed from the "msstore" source today have @JohnMcPMS does this code path get used for I'm ok with "--include-unknown". I think this will help much more than hurt or confuse. It might help to include a count for the number of packages with an unknown version.
I would add the " packages... Use..." at the end of the
|
@lechacon we should consider this for import as well. |
It appears to, but since the argument doesn't exist for |
Co-authored-by: Chacón <lechacon@users.noreply.github.com>
"Unknown" is considered to be a sentinel value meaning the lowest version of a package. When the installed version is also Unknown, no upgrade is shown as available. So, there shouldn't be a case where an available package with version "Unknown" is displayed as a potential upgrade in list when there is a version present in Apps & Features. I am just trying to make sure we capture all of the scenarios:
I believe the work here is for the last scenario. @JohnMcPMS to keep me honest, or at least correct me if I'm mistaken. |
@denelon, does this look good to you? Edit: note that the last commit doesn't output this message on |
@@ -766,6 +774,10 @@ namespace AppInstaller::CLI::Workflow | |||
context.Reporter.Info() << availableUpgradesCount << ' ' << Resource::String::AvailableUpgrades << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you are using different strings to report the count depending on whether there is a single package or multiple, but here we were using the same string for both cases. I think we should be doing the same for both messages; although I'm not sure which one would be better. I would lean towards using a single string regardless of the number of packages as I don't know if there are any languages that make any distinction beyond 1/many or that don't make distinctions at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked a bit into pluralization and it's a whole rabbit hole one can go into. I found it interesting to look at the rules for all languages...
I found some internal references to string formats for putting all variants in a single string and using libraries for handling that. @JohnMcPMS does the current setup support something like that? @JohnMcPMS , @denelon , is this something we would want to handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that too, but figured it was a separate PR... thanks for pointing it out :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanted to do something to handle plurals programmatically, then we could probably do it at the same time as the dynamic string replacement mentioned above. I don't see it as important as the dynamic strings though, so depending on the complexity we might just leave a nice place for it. I don't know if the english standard of making it "optional" like:
N installed package version(s) cannot be determined.
applies to the other supported languages. But it might be an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I go ahead and use a optional plural for now? SourceOpenFailedSuggestion
uses it ("Failed when opening source(s); try the 'source reset' command if the problem persists.")...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good to me.
@lechacon Do you want me to add the argument to |
It makes sense to me to not consider if the current version is unknown when updating to a specific version. If the installed version is unknown and we are installing specific versions from the json, I would agree with making it work the same as upgrade, which I'm fine if that is always updating from unknown versions. If we are installing the latest, I think the behavior would be better driven by whether the package is already installed (#1763) and not by whether it has unknown version. So I don't think we need the |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #1692.
This PR adds a argument,
--include-unknown
, towinget upgrade
. This argument controls whether to evaluate packages for upgrade if they have "Unknown" versions (basically, if the version is not set in the ARP table). This resolves a lot of user confusion where every time they runwinget upgrade --all
, packages will be upgraded regardless of whether they actually need it because winget is not sure if it needs an upgrade or not.I know nobody from MS commented on that issue, so if anyone has issues with this solution, I'm happy to redo this. The issue also has some discussion on whether or not upgrades for unknown packages should be shown by default in the upgrade table. The way I have it, the argument must be used for the upgrade to show in the table.
Tested: manually. As always, I'm happy to write unit tests if needed.
Microsoft Reviewers: Open in CodeFlow