winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Use installed version for package disambiguation

Open Trenly opened this issue 3 years ago • 0 comments

Description of the new feature / enhancement

I'm not sure if this is a bug or a new feature, since I see some stuff happening with versions in the logs. I'm marking it as a feature for now, under the presumption that providing the user expectation of how it functions will lead to more meaningful triage and discussion.


There are times when multiple matching packages are found, especially during upgrade or export. One of the best examples of this is OBSProject.OBSStudio and OBSProject.OBSStudio.Pre-release I've captured the logs of upgrade and export here

While we are waiting for #147 OBS Studio has been split into these separate packages, as have many others. The key factor here is that there are no matching versions in these two packages.

image


I currently have version 27.1.3 installed on my system. Given that this version does not exist in OBSProject.OBSStudio.Pre-release, this should be a disambiguating factor which clearly points to which of the two packages I have installed

Proposed technical implementation details

If multiple matches are found for a package, get the current version the user has installed. I'll refer to this as INSALLED_VERSION for clarity.

  • If INSTALLED_VERSION is unknown, do not disambiguate by version
  • If INSTALLED_VERSION does not exist for any matching package identifier, do not disambiguate by version
  • If INSTALLED_VERSION exists in more than one matching package identifier, do not disambiguate by version
  • If INSTALLED_VERSION exists in exactly one package identifier, ensure that the disambiguation is valid, and then select the matching package identifier as correct; A warning to the user may be appropriate, to cover the edge case where the source may be missing a version

Trenly avatar Feb 18 '22 14:02 Trenly