chocolatey-community / chocolatey-packages

Chocolatey Community Maintainers Team Packages - packages that are managed and maintained by core community team for community package repository (https://community.chocolatey.org/packages)
https://community.chocolatey.org/profiles/chocolatey-community
Apache License 2.0
448 stars 380 forks source link

(tortoisegit) Package upgrade fails if software was previously upgraded outside of Chocolatey #2159

Closed brogers5 closed 1 year ago

brogers5 commented 1 year ago

Chocolatey Version

1.3.0

Chocolatey License

None

Package Version

2.13.0.1 -> 2.14.0.0

Current Behaviour

Installation fails with error code 1603, likely because the installer does not support a silent reinstallation.

Expected Behaviour

Package should detect the currently installed version (if any) of TortoiseGit.

If the install/upgrade is not forced, and the packaged version matches the currently installed version, skip installation to avoid an installation failure.

Steps To Reproduce

  1. Install a previous version of TortoiseGit via Chocolatey (e.g. choco install tortoisegit --version=2.13.0.1).
  2. Install a later version of TortoiseGit manually. 32-bit: https://download.tortoisegit.org/tgit/2.14.0.0/TortoiseGit-2.14.0.0-32bit.msi 64-bit: https://download.tortoisegit.org/tgit/2.14.0.0/TortoiseGit-2.14.0.0-64bit.msi
  3. Upgrade to the corresponding Chocolatey package version (e.g. choco upgrade tortoisegit --version=2.14.0.0).

Environment

- Operating System: Microsoft Windows NT 10.0.19042.0
- PowerShell Version: 5.1.19041.2364
- Shell: Windows PowerShell

Chocolatey Log

https://gist.github.com/brogers5/896f57853fc0c28652a4a985cafe7d1b

Anything else?

Core maintainers: feel free to assign this to me.

Jericho commented 1 year ago

I am experiencing the same problem. Exactly as @brogers5 described, I installed tortoisegit using chocolatey and at some point I upgraded it manually because the choco package was not yet updated to the latest version. I didn't think this would be a problem. I thought, surely choco will realize I have a more recent version installed and won't bother telling me that I need to upgrade.

To illustrate further, here's what I see when I execute choco outdated: image

and here's the result when I execute choco upgrade tortoisegit -y: image

Please note the that 2.13.0.1 is the version of tortoisegit I installed with choco but it's not the version installed on my machine. Due to the upgrade I manual executed, the version currently installed on my machine is 2.14.0.0.

To be crystal clear: I rebooted my machine to make sure to eliminate the possibility of a pending reboot causing this issue. I also tried appending -force to the choco upgrade command but it failed with the same error message.

As an aside: does anybody know if there is a way to turn off tortoisegit's auto-update?

pauby commented 1 year ago

Thanks for raising this issue.

The Chocolatey Community Chocolatey Packages repository is maintained by community members. To resolve this issue, there are two options:

  1. Wait for a current community maintainer to resolve the issue.
  2. Look to resolve the issue yourself, submit a pull request and engage with the community.

We have documentation that will help you:

If you have any further questions, please add a discussion.

brogers5 commented 1 year ago

@Jericho, PR #2161 should resolve the issue.

In the meanwhile, you can upgrade the package with the --skip-powershell switch to skip running chocolateyInstall.ps1. As for TortoiseGit's auto-update option, the Settings dialog should expose this option on the General page. TortoiseGit AutoUpdate

Jericho commented 1 year ago

@brogers5 thanks for the tip about skip-powershell. I wasn't aware of this switch. I tried it and it worked! I also turned off auto-update to avoid this problem until your PR is merged.