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

chocolateyBeforeModify.ps1 does not get called for dependent packages #1092

Closed
6opuc opened this issue Dec 16, 2016 · 10 comments · Fixed by #3051
Closed

chocolateyBeforeModify.ps1 does not get called for dependent packages #1092

6opuc opened this issue Dec 16, 2016 · 10 comments · Fixed by #3051
Assignees
Milestone

Comments

@6opuc
Copy link

6opuc commented Dec 16, 2016

  1. I have two packages A and B.
  2. Package B is a dependency of package A.
  3. Currently both packages are installed with version 1.0
  4. Both packages are at version 1.1 in package repository(both packages are newer than installed ones)
  5. After calling "choco upgrade A" both packages gets updated to version 1.1(which is good)
  6. But chocolateyBeforeModify.ps1 gets called only for package A(I expected that chocolateyBeforeModify.ps1 should be called for package B also)

chocolatey log: chocolatey.log.txt

@ferventcoder
Copy link
Member

That's interesting and definitely not desired. I find it odd that it doesn't handle that situation accurately.

@ferventcoder
Copy link
Member

As the issue template requested, can you provide a gist of the debug / verbose output? You should have this from what you ran already. It will be in C:\ProgramData\chocolatey\logs\chocolatey.log.

Once we have that, it will provide some better terms for evaluation.

@6opuc
Copy link
Author

6opuc commented Dec 16, 2016

Ok, i'll post it on monday.
Thanks for Your efforts!

@ferventcoder
Copy link
Member

Thank you. 👍

@6opuc
Copy link
Author

6opuc commented Dec 19, 2016

I've attached chocolatey.log file: https://github.com/chocolatey/choco/files/660065/chocolatey.log.txt

Command issued in console was: choco upgrade itsk.af.local -y

Package dependency tree looks like this:
itsk.af.local
-> itsk.af.db.local
-> itsk.af.dispatcher.local
-> itsk.af.integration.local
-> itsk.af.scheduler.local
-> itsk.af.api.local
-> itsk.af.client.local
-> itsk.af.frontend.local

Each package has tools\chocolateyBeforeModify.ps1 with the same content:
Write-Host $MyInvocation.MyCommand.Definition

But tools\chocolateyBeforeModify.ps1 gets called only for itsk.af.local

@billw2012
Copy link

billw2012 commented Apr 12, 2018

This still appears to be a broken, please fix.

@ferventcoder
Copy link
Member

I think we know why this is occurring - we'll prolly need to do some additional checks closer to when those dependent packages are discovered for upgrade.

@tpidor
Copy link

tpidor commented Dec 11, 2018

We have the same problem as well. We're using a meta-package which depends on multiple packages.
Dependencies for example:
meta-package
-> install-pkg-a
-> install-pkg-b
However, one of the parent packages install-pkg-a needs to uninstall the installed msi first before re-installing. We use the chocolateyBeforeModify.ps1 to uninstall the previous version before upgrading. This is working well when doing choco upgrade install-pkg-a, it managed to uninstall the previous version. But when doing choco upgrade meta-package, the new version of install-pkg-a does not run chocolateyBeforeModify.ps1. My next attempt on this issue is to put uninstall steps from chocolateyBeforeModify.ps1 into chocolateyinstall.ps1.

@ferventcoder ferventcoder modified the milestones: 0.10.13, 0.10.14 Mar 15, 2019
@ferventcoder ferventcoder modified the milestones: 0.10.14, 0.10.15 Apr 1, 2019
@gep13 gep13 modified the milestones: 0.10.15, 0.10.16 May 31, 2019
@oldium
Copy link

oldium commented May 8, 2020

Users of keepass package (including me) are repeatedly facing this issue (just see the comments). Would it be possible to fix this, please?

vexx32 added a commit to vexx32/choco that referenced this issue Mar 1, 2023
This addition is necessary, as many occasions may arise where installing
one package involves updating an already-installed dependency. In these
cases we should still be running a beforeModify script if it's present,
and this facilitates that.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 8, 2023
This addition is necessary, as many occasions may arise where installing
one package involves updating an already-installed dependency. In these
cases we should still be running a beforeModify script if it's present,
and this facilitates that.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 10, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 10, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 10, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 13, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.
@vexx32 vexx32 self-assigned this Mar 14, 2023
gep13 added a commit that referenced this issue Mar 14, 2023
(#1092) Ensure chocolateyBeforeModify.ps1 is run for dependencies
@vexx32 vexx32 closed this as completed Mar 14, 2023
@choco-bot
Copy link

🎉 This issue has been resolved in version 1.3.1 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

vexx32 added a commit to vexx32/choco that referenced this issue Mar 14, 2023
This addition is necessary, as many occasions may arise where installing
one package involves updating an already-installed dependency. In these
cases we should still be running a beforeModify script if it's present,
and this facilitates that.

(cherry picked from commit 3a30cbc)

# Conflicts:
#	src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs
vexx32 added a commit to vexx32/choco that referenced this issue Mar 14, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.

(cherry picked from commit 49cc8d7)

# Conflicts:
#	src/chocolatey.tests.integration/chocolatey.tests.integration.csproj
#	src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
#	src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs
#	src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs
vexx32 added a commit to vexx32/choco that referenced this issue Mar 14, 2023
Changes originally in 9f5d9cc, adapted
for the current develop branch and the changes therein.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 14, 2023
Changes originally in 9f5d9cc, adapted
for the current develop branch and the changes therein.

Additionally, replaced and obsoleted some overloads of public (why?)
methods that have unused method arguments and made them protected.
vexx32 added a commit to vexx32/choco that referenced this issue Mar 15, 2023
This addition is necessary, as many occasions may arise where installing
one package involves updating an already-installed dependency. In these
cases we should still be running a beforeModify script if it's present,
and this facilitates that.

(cherry picked from commit 3a30cbc)

# Conflicts:
#	src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs
vexx32 added a commit to vexx32/choco that referenced this issue Mar 15, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.

(cherry picked from commit 49cc8d7)

# Conflicts:
#	src/chocolatey.tests.integration/chocolatey.tests.integration.csproj
#	src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
#	src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs
#	src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs
vexx32 added a commit to vexx32/choco that referenced this issue Mar 15, 2023
Changes originally in 9f5d9cc, adapted
for the current develop branch and the changes therein.

Additionally, replaced and obsoleted some overloads of public (why?)
methods that have unused method arguments and made them protected.
gep13 pushed a commit to vexx32/choco that referenced this issue Mar 16, 2023
This addition is necessary, as many occasions may arise where installing
one package involves updating an already-installed dependency. In these
cases we should still be running a beforeModify script if it's present,
and this facilitates that.

(cherry picked from commit 3a30cbc)
gep13 pushed a commit to vexx32/choco that referenced this issue Mar 16, 2023
This test added ensures that when we are upgrading a package, both its
own and any dependencies' beforeModify are run so that we can properly
update dependencies which might need to shut down a long-running service
before being upgraded.

(cherry picked from commit 49cc8d7)

# Conflicts:
#	src/chocolatey.tests.integration/chocolatey.tests.integration.csproj
#	src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
#	src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs
#	src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs
gep13 pushed a commit to vexx32/choco that referenced this issue Mar 16, 2023
Changes originally in 9f5d9cc, adapted
for the current develop branch and the changes therein.

Additionally, replaced and obsoleted some overloads of public (why?)
methods that have unused method arguments and made them protected.
gep13 added a commit that referenced this issue Mar 16, 2023
(#1092) Incorporate beforemodify changes into develop branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants