microsoft / winget-create

The Windows Package Manager Manifest Creator command-line tool (aka wingetcreate)
MIT License
472 stars 83 forks source link

Improve matching for ZIP with multiple nested installers #529

Open mdanish-kh opened 3 months ago

mdanish-kh commented 3 months ago

Change

This PR adds support for handling multiple nested installers inside of a ZIP archive for the autonomous update mode. With the current behavior of parsing every nested installer, it can lead to generation of duplicate "installer" nodes for each nested installer. This change clears out the duplicates and subsequently only retains the nested installers that are present in the matching installer node from previous manifest.

Tests

Added unit test to verify the behavior and updated an existing test for better coverage. The new files i.e., WingetCreateTestPortable.exe, WingetCreateTestPortable2.exe are created by making a copy of the existing WingetCreateTestExeInstaller.exe

I also updated the issue body to add more examples from the community repo for manual validation.

Edge case

There's still an unhandled edge case if the manifest contains msixbundle as a NestedInstallerFile. But this is extremely rare, and the current change should cover the vast majority of cases. In fact, I performed a search in the community repo and could only find two packages with NestedInstallerType: msix (and one of them being devhome with its first ever release, so we can safely discard that too). Even if the user encounters this case, the package is still upgrade-able through the interactive mode


Microsoft Reviewers: Open in CodeFlow
ryfu-msft commented 4 days ago

/azp run

azure-pipelines[bot] commented 4 days ago
Azure Pipelines successfully started running 1 pipeline(s).