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

Support redirecting manifests

Open denelon opened this issue 3 years ago • 3 comments

Description of the new feature / enhancement

Sometimes a package id gets changed. Usually this happens when the publisher changes, or when the community has determined a better approach for organizing manifests. When this happens, users who have packages.json files could be broken, and the install of those packages that have been moved will fail.

Proposed technical implementation details

Current thinking is that we would leverage a new YAML file "Redirect.yaml". This file would be placed in the package directory (as opposed to the version directories) as a signal that the package has been moved. The client would be able to understand what to install.

Examples:

Foo.Bar has been redirected to Contoso.Bar

winget install Foo.Bar would inform the user that the package has been redirected to Contoso.Bar, and Contoso..Bar would be installed.

>winget install Foo.Bar
Found Bar [Foo.Bar]. The package has been redirected to Bar [Contoso.Bar].
Found Bar [Contoso.Bar] Version 2.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://www.contoso.com/bar.exe
  ██████████████████████████████  1.77 MB / 1.77 MB
Successfully verified installer hash
Starting package install...
Successfully installed

winget upgrade Foo.Bar Upgrading a package that has been redirected.

>winget upgrade Foo.Bar
Found Bar [Foo.Bar]. The package has been redirected to Bar [Contoso.Bar]. 
Found Bar [Contoso.Bar] Version 2.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://www.contoso.com/bar.exe
  ██████████████████████████████  1.77 MB / 1.77 MB
Successfully verified installer hash
Starting package install...
Successfully installed

If a user were to perform a search, the "old" package would not be displayed by default.

winget search -e --id Foo.Bar - No package found

>winget search Foo.Bar
"No package found matching input criteria."

winget search -e --id Foo.Bar --includeRedirected - Foo.Bar is found and has been redirected to Contoso.Bar

The UX for displaying redirected packages may not fit well in the current table format. Suggestions are welcome.


Settings would be added to change default behavior.

"searchFilters": {
  "redirectedPackages": "include"
}

The default behavior would be to exclude.

denelon avatar Feb 03 '22 19:02 denelon