microsoft / winget-create

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

Avoid creating installer node with duplicate NestedInstallerFile #419

Closed mdanish-kh closed 1 year ago

mdanish-kh commented 1 year ago

This PR fixes a regression introduced with PR #415 where manifests generated for certain ZIP installers i.e., that have common NestedInstallerFiles in base manifest across each installer node were incorrect. The code before #415 worked with distinct relative file paths. In #415, the behavior was modified to use the whole NestedInstallerFile object instead of RelativeFilePaths only but the code was not updated to have distinct NestedInstallerFiles object added into baseInstaller. This PR fixes that behavior.

The previous tests didn't catch this bug. Added a new test case that covers this behavior.

Manifests to test with

Some examples to compare the behavior with current main branch build and this PR's build:

wingetcreate update nim.nim -v 18.0 --urls "https://nim-lang.org/download/nim-1.6.12_x64.zip" "https://nim-lang.org/download/nim-1.6.12_x32.zip"
wingetcreate update junegunn.fzf -v 18.0 --urls "https://github.com/junegunn/fzf/releases/download/0.42.0/fzf-0.42.0-windows_amd64.zip" "https://github.com/junegunn/fzf/releases/download/0.42.0/fzf-0.42.0-windows_armv7.zip" "https://github.com/junegunn/fzf/releases/download/0.42.0/fzf-0.42.0-windows_arm64.zip"
wingetcreate update TerraformLinters.tflint -v 18.0 --urls "https://github.com/terraform-linters/tflint/releases/download/v0.45.0/tflint_windows_386.zip" "https://github.com/terraform-linters/tflint/releases/download/v0.45.0/tflint_windows_amd64.zip"
wingetcreate update AdGuard.AdGuardHome -v 18.0 --urls "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.23/AdGuardHome_windows_amd64.zip" "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.23/AdGuardHome_windows_386.zip" "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.23/AdGuardHome_windows_arm64.zip"

Microsoft Reviewers: codeflow:open?pullrequest=https://github.com/microsoft/winget-create/pull/419&drop=dogfoodAlpha
ryfu-msft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
ryfu-msft commented 1 year ago

/azp run

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