From 2eacdd62f3ac59be1eca4a86f7a85c4de4c8ca84 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Mon, 27 Feb 2023 16:52:48 -0500 Subject: [PATCH] (#1092) Update ISourceRunner install_run 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. --- src/chocolatey/infrastructure.app/services/CygwinService.cs | 2 +- src/chocolatey/infrastructure.app/services/ISourceRunner.cs | 5 +++-- src/chocolatey/infrastructure.app/services/NugetService.cs | 2 +- src/chocolatey/infrastructure.app/services/PythonService.cs | 2 +- .../infrastructure.app/services/RubyGemsService.cs | 2 +- src/chocolatey/infrastructure.app/services/WebPiService.cs | 2 +- .../infrastructure.app/services/WindowsFeatureService.cs | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/CygwinService.cs b/src/chocolatey/infrastructure.app/services/CygwinService.cs index cae6dbd651..14108274d1 100644 --- a/src/chocolatey/infrastructure.app/services/CygwinService.cs +++ b/src/chocolatey/infrastructure.app/services/CygwinService.cs @@ -233,7 +233,7 @@ public void install_noop(ChocolateyConfiguration config, Action c this.Log().Info("Would have run '{0} {1}'".format_with(get_exe(RootDirectory).escape_curly_braces(), args.escape_curly_braces())); } - public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null) { var args = build_args(config, _installArguments); var packageResults = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs index 3a1aaac649..17da41bf1f 100644 --- a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs +++ b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs @@ -74,8 +74,9 @@ public interface ISourceRunner /// /// The configuration. /// The action to continue with when install is successful. + /// The action (if any) to run on any currently installed package dependencies before triggering the install or updating those dependencies. /// results of installs - ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction); + ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null); /// /// Run upgrade in noop mode @@ -89,7 +90,7 @@ public interface ISourceRunner /// /// The configuration. /// The action to continue with when upgrade is successful. - /// The action (if any) to run on any currently installed package before triggering the upgrade. + /// The action (if any) to run on any currently installed package or its dependencies before triggering the upgrade. /// results of installs ConcurrentDictionary upgrade_run(ChocolateyConfiguration config, Action continueAction, Action beforeUpgradeAction = null); diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 158662e00a..01a7fd17d0 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -383,7 +383,7 @@ public void install_noop(ChocolateyConfiguration config, Action c ApplicationParameters.PackagesLocation = installLocation; } - public virtual ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + public virtual ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null) { _fileSystem.create_directory_if_not_exists(ApplicationParameters.PackagesLocation); var packageInstalls = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/chocolatey/infrastructure.app/services/PythonService.cs b/src/chocolatey/infrastructure.app/services/PythonService.cs index 4e59ed8b50..20ae6e9e0e 100644 --- a/src/chocolatey/infrastructure.app/services/PythonService.cs +++ b/src/chocolatey/infrastructure.app/services/PythonService.cs @@ -336,7 +336,7 @@ public void install_noop(ChocolateyConfiguration config, Action c this.Log().Info("Would have run '{0} {1}'".format_with(_exePath.escape_curly_braces(), args.escape_curly_braces())); } - public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null) { set_executable_path_if_not_set(); var args = build_args(config, _installArguments); diff --git a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs index 8cfed8d964..cad40a9910 100644 --- a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs +++ b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs @@ -195,7 +195,7 @@ public void install_noop(ChocolateyConfiguration config, Action c this.Log().Info("Would have run '{0} {1}'".format_with(EXE_PATH.escape_curly_braces(), args.escape_curly_braces())); } - public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null) { var packageResults = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); var args = ExternalCommandArgsBuilder.build_arguments(config, _installArguments); diff --git a/src/chocolatey/infrastructure.app/services/WebPiService.cs b/src/chocolatey/infrastructure.app/services/WebPiService.cs index 96b70382ad..10f33985eb 100644 --- a/src/chocolatey/infrastructure.app/services/WebPiService.cs +++ b/src/chocolatey/infrastructure.app/services/WebPiService.cs @@ -213,7 +213,7 @@ public void install_noop(ChocolateyConfiguration config, Action c this.Log().Info("Would have run '{0} {1}'".format_with(EXE_PATH.escape_curly_braces(), args.escape_curly_braces())); } - public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null) { write_deprecation_warning(); var packageResults = new ConcurrentDictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs index a960c1e9ca..85901d7272 100644 --- a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs +++ b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs @@ -257,7 +257,7 @@ public void install_noop(ChocolateyConfiguration config, Action c this.Log().Info("Would have run '{0} {1}'".format_with(_exePath.escape_curly_braces(), args.escape_curly_braces())); } - public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction) + public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction = null) { set_executable_path_if_not_set(); var args = build_args(config, _installArguments);