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

Implement scope override and scope detection from installer URL #367

Merged
merged 7 commits into from
May 5, 2023

Conversation

ryfu-msft
Copy link
Contributor

@ryfu-msft ryfu-msft commented Apr 26, 2023

Currently there is no way for winget-create to detect the scope of an installer. This PR adds the override functionality to allow users to specify the intended scope of the installer to improve matching performance during updates.

Changes:

  • Users can now append |user or |scope to the installer URL to specify the scope they want.
  • Changed the behavior of installer matching logic. If an architecture override is specified, then that is the architecture used for matching. If no match is found, winget-create does not fallback to the detected arch from either the URL or binary. I believe if the user specifies the override, this is the intended architecture that they want to use for matching.
  • Added scope detection based on parsing the installer URL.
  • Refactor matching logic for simplicity.

Tests:

  • Verifies scope override works as expected
  • Verifies scope can be detected from the installer URL
Microsoft Reviewers: Open in CodeFlow

@ryfu-msft ryfu-msft requested a review from a team as a code owner April 26, 2023 23:27
@ryfu-msft ryfu-msft requested review from yao-msft and removed request for a team April 26, 2023 23:27
Copy link
Contributor

@mdanish-kh mdanish-kh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArchitectureOverride_Warning Resource string may also need to be updated. An updated message may be something like:

If the installer you provided fails to match an existing installer even when overriding the architecture, you may need to override the scope or edit the existing manifest manually. Make sure that the existing manifest has a single installer that matches the overriding architecture, scope and installer type of the new installer. To modify an existing manifest, use the '--interactive' flag with the update command and submit the new changes. Once the changes are published, please try again.

src/WingetCreateCore/Common/PackageParser.cs Outdated Show resolved Hide resolved
src/WingetCreateCLI/Commands/UpdateCommand.cs Outdated Show resolved Hide resolved
src/WingetCreateCLI/Commands/UpdateCommand.cs Outdated Show resolved Hide resolved
src/WingetCreateCore/Common/PackageParser.cs Show resolved Hide resolved
src/WingetCreateCLI/Commands/UpdateCommand.cs Outdated Show resolved Hide resolved
Copy link

@yao-msft yao-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

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.

3 participants