From 41e6cab2aab496934ebe777ed5e740b827825d7c Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sun, 25 Sep 2016 11:00:08 -0500 Subject: [PATCH 01/15] (docs) clean up messaging for logo use policy --- docs/logo/LogoUsePolicy.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/logo/LogoUsePolicy.md b/docs/logo/LogoUsePolicy.md index db46cbf62d..03d4e298de 100644 --- a/docs/logo/LogoUsePolicy.md +++ b/docs/logo/LogoUsePolicy.md @@ -2,14 +2,16 @@ The Apache 2.0 license does not apply for the logos/marks. Chocolatey open source code falls under the Apache 2.0 license, which permits third parties to copy and redistribute the underlying software under the terms of the license. However, the Apache 2.0 license does not provide any license or right to use any of the Chocolatey marks, including logos. You may redistribute the applicable Chocolatey open source software under the terms of the Apache 2.0 license, but you may not use the Chocolatey marks in doing so without express written permission from RealDimensions Software, LLC. +# Chocolatey Marks / Logo + You must obtain written permission from RealDimensions Software, LLC, to use the Chocolatey marks for any use, including but not limited to; (i) merchandising purposes (e.g. T-shirts, mugs); (ii) on or in relation to a software product that includes or is built on top of any Chocolatey product, including Chocolatey's open source projects; or (iii) in an attention-getting or branding manner. Without the express prior written consent of RealDimensions Software, LLC, no Chocolatey Marks may be used in a manner that implies an affiliation with, approval by, endorsement of or sponsorship by RealDimensions Software, LLC. -### General Use +## General Use You may use Chocolatey marks/logos, without a license, provided such use complies with the following requirements: (i) the Chocolatey mark is used only to refer to the Chocolatey project, framework, and/or technology; (ii) the Chocolatey mark is not used as part of your product, brand, domain, URL, or service name; (iii) the Chocolatey mark appears less prominent than your company or product name; (iv) the reference to Chocolatey does not create a sense of endorsement, sponsorship, or ownership by Chocolatey and/or RealDimensions Software, LLC; and/or (v) your use of the Chocolatey mark is necessary to fully describe your services or products and is limited to as much of the Chocolatey Mark as is necessary for such identification ("Nominative Use"). NO OTHER USE OF THE CHOCOLATEY MARK IS PERMITTED WITHOUT A WRITTEN LICENSE AGREEMENT. -### Plain Speak +## Plain Speak **NOTE**: This section ("Plain Speak") in no way changes what is written in the rest of this document. This only attempts to provide some clarity. If there is a conflict with another section, the other section applies. -Without an express written agreement, you cannot use the Chocolatey logos as part of your brand/product. \ No newline at end of file +Without an express written agreement, you cannot use the Chocolatey logos as part of your brand/product. From 991b521d57185e16debdac0434d092b1086fd320 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Tue, 27 Sep 2016 10:26:09 -0500 Subject: [PATCH 02/15] (GH-982) Note AutoUninstaller in uninstall template Provide guidance at the top of the uninstall template that the uninstall script may be unnecessary due to AutoUninstaller and licensed version enhancements. --- .../templates/ChocolateyUninstallTemplate.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs b/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs index bf2fd9d1fc..de23a9aade 100644 --- a/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs +++ b/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs @@ -22,6 +22,9 @@ public class ChocolateyUninstallTemplate # $f='c:\path\to\thisFile.ps1' # gc $f | ? {$_ -notmatch ""^\s*#""} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+"".~"" -en utf8; mv -fo $f+"".~"" $f +## NOTE: In 80-90% of the cases (95% with licensed versions due to Package Synchronizer and other enhancements), you may +## not need this file due to AutoUninstaller. See https://chocolatey.org/docs/commands-uninstall + ## If this is an MSI, cleaning up comments is all you need. ## If this is an exe, change installerType and silentArgs ## Auto Uninstaller should be able to detect and handle registry uninstalls (if it is turned on, it is in preview for 0.9.9). From 7ea5290831b30d00168f9d675ec313a6694aac3b Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Tue, 27 Sep 2016 10:50:38 -0500 Subject: [PATCH 03/15] (GH-983) Do not add unparsed options to package names When an unparsed option starts with `-` or `--`, that was not meant to be a package name so do not add it to the list of packages to install. A package also cannot start with a dash as its id so it is fine not to add them to the list. --- .../infrastructure.app/commands/ChocolateyInstallCommand.cs | 3 ++- .../infrastructure.app/commands/ChocolateyUninstallCommand.cs | 3 ++- .../infrastructure.app/commands/ChocolateyUpgradeCommand.cs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index a8654b5c1f..1aa0e17a47 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -17,6 +17,7 @@ namespace chocolatey.infrastructure.app.commands { using System; using System.Collections.Generic; + using System.Linq; using attributes; using commandline; using configuration; @@ -157,7 +158,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon public virtual void handle_additional_argument_parsing(IList unparsedArguments, ChocolateyConfiguration configuration) { configuration.Input = string.Join(" ", unparsedArguments); - configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.to_string(), unparsedArguments); + configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.to_string(), unparsedArguments.Where(arg => !arg.StartsWith("-"))); } public virtual void handle_validation(ChocolateyConfiguration configuration) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index b132ada68f..0417a17cb4 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -17,6 +17,7 @@ namespace chocolatey.infrastructure.app.commands { using System; using System.Collections.Generic; + using System.Linq; using attributes; using commandline; using configuration; @@ -118,7 +119,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon public virtual void handle_additional_argument_parsing(IList unparsedArguments, ChocolateyConfiguration configuration) { configuration.Input = string.Join(" ", unparsedArguments); - configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.to_string(), unparsedArguments); + configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.to_string(), unparsedArguments.Where(arg => !arg.StartsWith("-"))); } public virtual void handle_validation(ChocolateyConfiguration configuration) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index cf3d9f25e3..662ee8779c 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -17,6 +17,7 @@ namespace chocolatey.infrastructure.app.commands { using System; using System.Collections.Generic; + using System.Linq; using attributes; using commandline; using configuration; @@ -162,7 +163,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon public virtual void handle_additional_argument_parsing(IList unparsedArguments, ChocolateyConfiguration configuration) { configuration.Input = string.Join(" ", unparsedArguments); - configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.to_string(), unparsedArguments); + configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.to_string(), unparsedArguments.Where(arg => !arg.StartsWith("-"))); } public virtual void handle_validation(ChocolateyConfiguration configuration) From 7c4a3be77d1e70853d78f93b71945b61d5235e0e Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Tue, 27 Sep 2016 10:52:59 -0500 Subject: [PATCH 04/15] (GH-984) Detect licensed options in FOSS When an option is passed to open source Chocolatey that is only available in licensed versions, provide a helpful error message so that there is reduced confusion for the user. --- .../commands/ChocolateyInstallCommand.cs | 16 ++++++++++++++ .../commands/ChocolateyUpgradeCommand.cs | 22 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index 1aa0e17a47..597cd04ed1 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -178,6 +178,22 @@ public virtual void handle_validation(ChocolateyConfiguration configuration) { throw new ApplicationException("Force dependencies can only be used with force also turned on."); } + + if (!string.IsNullOrWhiteSpace(configuration.Input)) + { + var unparsedOptionsAndPackages = configuration.Input.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); + if (!configuration.Information.IsLicensedVersion) + { + foreach (var argument in unparsedOptionsAndPackages.or_empty_list_if_null()) + { + var arg = argument.to_lower(); + if (arg.StartsWith("-dir") || arg.StartsWith("--dir") || arg.StartsWith("-install") || arg.StartsWith("--install")) + { + throw new ApplicationException("It appears you are attempting to use options that may be only available in licensed versions of Chocolatey ('{0}'). Please remove and consult the documentation.".format_with(arg)); + } + } + } + } } public virtual void help_message(ChocolateyConfiguration configuration) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 662ee8779c..dad5245eaa 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -172,6 +172,28 @@ public virtual void handle_validation(ChocolateyConfiguration configuration) { throw new ApplicationException("Package name is required. Please pass at least one package name to upgrade."); } + + if (configuration.ForceDependencies && !configuration.Force) + { + throw new ApplicationException("Force dependencies can only be used with force also turned on."); + } + + if (!string.IsNullOrWhiteSpace(configuration.Input)) + { + var unparsedOptionsAndPackages = configuration.Input.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); + if (!configuration.Information.IsLicensedVersion) + { + foreach (var argument in unparsedOptionsAndPackages.or_empty_list_if_null()) + { + var arg = argument.to_lower(); + if (arg.StartsWith("-dir") || arg.StartsWith("--dir") || arg.StartsWith("-install") || arg.StartsWith("--install")) + { + throw new ApplicationException( + "It appears you are attempting to use options that may be only available in licensed versions of Chocolatey ('{0}'). Please remove and consult the documentation.".format_with(arg)); + } + } + } + } } public virtual void help_message(ChocolateyConfiguration configuration) From d0da9607e5dc32038f0cd0c2e655a619898717d0 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Tue, 27 Sep 2016 11:38:13 -0500 Subject: [PATCH 05/15] (GH-985) rollback automatically on user cancel When a user selects not to run an automation script, automatically rollback the files. Also provide guidance that package files have been upgraded so its easily discerned that there are multiple steps of install/upgrade. --- .../services/ChocolateyPackageService.cs | 15 ++++++++++++++- .../services/PowershellService.cs | 6 ++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 7c98ab7257..6d3026d5e3 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -332,6 +332,9 @@ public void handle_package_result(PackageResult packageResult, ChocolateyConfigu { EnvironmentSettings.reset_environment_variables(config); set_pending(packageResult, config); + + this.Log().Info("{0} package files {1} is complete. Performing other installation steps.".format_with(packageResult.Name, commandName.to_string())); + var pkgInfo = _packageInfoService.get_package_information(packageResult.Package); if (config.AllowMultipleVersions) { @@ -1117,7 +1120,17 @@ private void rollback_previous_version(ChocolateyConfiguration config, PackageRe this.Log().Debug("Attempting rollback"); var rollback = true; - if (config.PromptForConfirmation) + var shouldPrompt = config.PromptForConfirmation; + + // if user canceled, then automatically rollback without prompting. + //MSI ERROR_INSTALL_USEREXIT - 1602 - https://support.microsoft.com/en-us/kb/304888 / https://msdn.microsoft.com/en-us/library/aa376931.aspx + //ERROR_INSTALL_CANCEL - 15608 - https://msdn.microsoft.com/en-us/library/windows/desktop/ms681384.aspx + if (Environment.ExitCode == 15608 || Environment.ExitCode == 1602) + { + shouldPrompt = false; + } + + if (shouldPrompt) { var selection = InteractivePrompt.prompt_for_confirmation( " Unsuccessful operation for {0}.{1} Rollback to previous version (package files only)?".format_with(packageResult.Name, Environment.NewLine), diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 55de1e2847..966328342e 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -234,8 +234,10 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack if (selection.is_equal_to("yes")) shouldRun = true; if (selection.is_equal_to("no")) { - Environment.ExitCode = 1; - packageResult.Messages.Add(new ResultMessage(ResultType.Error, "User cancelled powershell portion of installation for '{0}'.{1} Specify -n to skip automated script actions.".format_with(chocoPowerShellScript, Environment.NewLine))); + //MSI ERROR_INSTALL_USEREXIT - 1602 - https://support.microsoft.com/en-us/kb/304888 / https://msdn.microsoft.com/en-us/library/aa376931.aspx + //ERROR_INSTALL_CANCEL - 15608 - https://msdn.microsoft.com/en-us/library/windows/desktop/ms681384.aspx + Environment.ExitCode = 15608; + packageResult.Messages.Add(new ResultMessage(ResultType.Error, "User canceled powershell portion of installation for '{0}'.{1} Specify -n to skip automated script actions.".format_with(chocoPowerShellScript, Environment.NewLine))); } } From d4ea8ce984b1b78006c68a19ebdd562469cd241e Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 28 Sep 2016 08:50:26 -0500 Subject: [PATCH 06/15] (GH-573) Explain Failing Uninstall Options When an uninstall fails, explain how to work around the uninstall of the packaging files. This message should come at the proper time so a user knows how they can mitigate the uninstall issues. --- .../services/ChocolateyPackageService.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 6d3026d5e3..1db1471f42 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -757,6 +757,26 @@ public ConcurrentDictionary uninstall_run(ChocolateyConfi Environment.ExitCode = 1; } + if (uninstallFailures != 0) + { + this.Log().Warn(@" +If a package uninstall is failing and/or you've already uninstalled the + software outside of Chocolatey, you can attempt to run the command + with `-n` to skip running a chocolateyUninstall script, additionally + adding `--skip-autouninstaller` to skip an attempt to automatically + remove system-installed software. This will only remove the packaging + files and not things like software installed to Programs and Features. + +If a package is failing because it is a dependency of another package + or packages, then you may first need to consider if it needs removed + as it is typically installed as a dependency for a reason. If you + decide that you still want to remove it, head into + `$env:ChocolateyInstall\lib` and find the package folder you want + removed. Then delete the folder for the package. This option should + only be used as a last resort. + "); + } + randomly_notify_about_pro_business(config); return packageUninstalls; From 67470c418a527191cdfb65b7fc956694b8bdda46 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 28 Sep 2016 20:59:23 -0500 Subject: [PATCH 07/15] (GH-986) Remove extra forward slashes in url --- .../helpers/functions/Get-ChocolateyWebFile.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 index 90f893220c..d446fe6540 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1 @@ -203,6 +203,9 @@ param( Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters + if ($url -ne $null) { $url = $url.Replace("//","/").Replace(":/","://") } + if ($url64bit -ne $null) { $url64bit = $url64bit.Replace("//","/").Replace(":/","://") } + $url32bit = $url # allow user provided values for checksumming From c74e51f5284eeb284ea25b1a3e03c49d6f2aeeaf Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 28 Sep 2016 21:03:19 -0500 Subject: [PATCH 08/15] (spec) support no prompting --- .../services/AutomaticUninstallerServiceSpecs.cs | 3 +++ .../infrastructure.app/ApplicationParameters.cs | 10 +++++++++- src/chocolatey/infrastructure/adapters/Console.cs | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs index 78f329f416..96324f2cfe 100644 --- a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs @@ -80,6 +80,9 @@ public override void Context() fileSystem.Setup(f => f.directory_exists(registryKeys.FirstOrDefault().InstallLocation)).Returns(true); registryService.Setup(r => r.installer_value_exists(registryKeys.FirstOrDefault().KeyPath, ApplicationParameters.RegistryValueInstallLocation)).Returns(true); fileSystem.Setup(f => f.get_full_path(expectedUninstallString)).Returns(expectedUninstallString); + + var field = typeof(ApplicationParameters).GetField("AllowPrompts"); + field.SetValue(null, false); } } diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 4c343f808e..7e0fee610b 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -109,10 +109,18 @@ public static class Environment public static readonly string HashProviderFileTooBig = "UnableToDetectChanges_FileTooBig"; public static readonly string HashProviderFileLocked = "UnableToDetectChanges_FileLocked"; - + + /// + /// This is a readonly bool set to true. It is only shifted for specs. + /// public static readonly bool LockTransactionalInstallFiles = true; public static readonly string PackagePendingFileName = ".chocolateyPending"; + /// + /// This is a readonly bool set to true. It is only shifted for specs. + /// + public static readonly bool AllowPrompts = true; + public static class Tools { //public static readonly string WebPiCmdExe = _fileSystem.combine_paths(InstallLocation, "nuget.exe"); diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 64d92b266c..32b12da974 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -15,8 +15,10 @@ namespace chocolatey.infrastructure.adapters { + using System; using System.IO; using System.Runtime.InteropServices; + using app; using commandline; using platforms; @@ -27,21 +29,29 @@ public sealed class Console : IConsole { public string ReadLine() { + if (!ApplicationParameters.AllowPrompts) return string.Empty; + return System.Console.ReadLine(); } public string ReadLine(int timeoutMilliseconds) { + if (!ApplicationParameters.AllowPrompts) return string.Empty; + return ReadLineTimeout.read(timeoutMilliseconds); } public System.ConsoleKeyInfo ReadKey(bool intercept) { + if (!ApplicationParameters.AllowPrompts) return new System.ConsoleKeyInfo('\0', ConsoleKey.Enter, false, false, false); + return System.Console.ReadKey(intercept); } public System.ConsoleKeyInfo ReadKey(int timeoutMilliseconds) { + if (!ApplicationParameters.AllowPrompts) return new System.ConsoleKeyInfo('\0', ConsoleKey.Enter, false, false, false); + return ReadKeyTimeout.read_key(timeoutMilliseconds); } From 6add8eaa938aea002c33879d425f096665a06c68 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Fri, 30 Sep 2016 02:00:05 -0500 Subject: [PATCH 09/15] (maint) fix message --- src/chocolatey/infrastructure.app/services/NugetService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 86b59f4124..481416ed86 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -814,7 +814,7 @@ public void backup_existing_version(ChocolateyConfiguration config, IPackage ins if (_fileSystem.directory_exists(pkgInstallPath)) { - this.Log().Debug("Backing up existing {0} prior to upgrade.".format_with(installedPackage.Id)); + this.Log().Debug("Backing up existing {0} prior to operation.".format_with(installedPackage.Id)); var backupLocation = pkgInstallPath.Replace(ApplicationParameters.PackagesLocation, ApplicationParameters.PackageBackupLocation); From 4ca10e7a2294caa86c85b555c9e09bbdc23a2779 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Fri, 30 Sep 2016 02:01:42 -0500 Subject: [PATCH 10/15] (maint) RefreshEnv.cmd mentions cmd.exe Since RefreshEnv.cmd could run in PowerShell and look like it does something when it really doesn't, it would be best to provde a subtle hint that this RefreshEnv applies to just cmd.exe. --- src/chocolatey.resources/redirects/RefreshEnv.cmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chocolatey.resources/redirects/RefreshEnv.cmd b/src/chocolatey.resources/redirects/RefreshEnv.cmd index a69184c2e0..3f11f901b2 100644 --- a/src/chocolatey.resources/redirects/RefreshEnv.cmd +++ b/src/chocolatey.resources/redirects/RefreshEnv.cmd @@ -8,7 +8,8 @@ :: With this batch file, there should be no need to reload command :: environment every time you want environment changes to propagate -echo | set /p dummy="Reading environment variables from registry. Please wait... " +::echo "RefreshEnv.cmd only works from cmd.exe, please install the Chocolatey Profile to take advantage of refreshenv from PowerShell" +echo | set /p dummy="Refreshing environment variables from registry for cmd.exe. Please wait... " goto main From a1896b410d48222386786a5d70e06c2b59304975 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Fri, 30 Sep 2016 02:04:32 -0500 Subject: [PATCH 11/15] (GH-992) Uninstall should always work with version When you are working with uninstall operations, the package found already has a version. Use that in calls to ensure that is the package being uninstalled, like in the case of side by side installs. --- src/chocolatey/infrastructure.app/services/NugetService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 481416ed86..0a988ee645 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -1173,13 +1173,13 @@ public ConcurrentDictionary uninstall_run(ChocolateyConfi { using (packageManager.SourceRepository.StartOperation( RepositoryOperationNames.Install, - packageName, - version == null ? null : version.ToString())) + packageVersion.Id, packageVersion.Version.to_string()) + ) { ensure_package_files_have_compatible_attributes(config, packageVersion, pkgInfo); rename_legacy_package_version(config, packageVersion, pkgInfo); backup_existing_version(config, packageVersion, pkgInfo); - packageManager.UninstallPackage(packageVersion, forceRemove: config.Force, removeDependencies: config.ForceDependencies); + packageManager.UninstallPackage(packageVersion.Id, forceRemove: config.Force, removeDependencies: config.ForceDependencies, version: packageVersion.Version); ensure_nupkg_is_removed(packageVersion, pkgInfo); remove_installation_files(packageVersion, pkgInfo); remove_cache_for_package(config, packageVersion); From 0f5493da46e7e4689d682104bd963e8fd09333f9 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Fri, 30 Sep 2016 02:06:39 -0500 Subject: [PATCH 12/15] (GH-992) search for sidebyside install first When path resolver is looking for the package directory, it should look to using the sidebyside first if that directory exists, then resort to providing the location based on the way side by side is set up for path resolver. --- .../nuget/ChocolateyPackagePathResolver.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs index 0a2d4235c8..acf86aa79f 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs @@ -34,16 +34,26 @@ public ChocolateyPackagePathResolver(IFileSystem nugetFileSystem, bool useSideBy public override string GetInstallPath(IPackage package) { - return Path.Combine(_nugetFileSystem.Root, GetPackageDirectory(package)); + var packageVersionPath = Path.Combine(_nugetFileSystem.Root, GetPackageDirectory(package.Id,package.Version,useVersionInPath:true)); + if (_nugetFileSystem.DirectoryExists(packageVersionPath)) return packageVersionPath; + + + return Path.Combine(_nugetFileSystem.Root, GetPackageDirectory(package.Id, package.Version)); } public override string GetPackageDirectory(string packageId, SemanticVersion version) + { + return GetPackageDirectory(packageId, version, UseSideBySidePaths); + } + + public string GetPackageDirectory(string packageId, SemanticVersion version, bool useVersionInPath) { string directory = packageId; - if (UseSideBySidePaths) + if (useVersionInPath) { directory += "." + version.to_string(); } + return directory; } From 170f9226cac32b7989118194bb4a75184e184783 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Fri, 30 Sep 2016 02:10:06 -0500 Subject: [PATCH 13/15] (GH-992) allow uninstall scripts for side by side When there are multiple side by side installs, choco should support automatically determine if it is a side by side install that we are uninstalling instead of expecting `--sxs` to be passed to the uninstall commands. Prior to this it only executed the uninstall behavior for the latest version of the package. --- src/chocolatey/infrastructure.app/services/NugetService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 0a988ee645..e7d8c3003b 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -1011,9 +1011,10 @@ public ConcurrentDictionary uninstall_run(ChocolateyConfi return; } - // is this the latest version or have you passed --sxs? This is the only way you get through to the continue action. + // is this the latest version, have you passed --sxs, or is this a side-by-side install? This is the only way you get through to the continue action. var latestVersion = packageManager.LocalRepository.FindPackage(e.Package.Id); - if (latestVersion.Version == pkg.Version || config.AllowMultipleVersions) + var pkgInfo = _packageInfoService.get_package_information(e.Package); + if (latestVersion.Version == pkg.Version || config.AllowMultipleVersions || (pkgInfo != null && pkgInfo.IsSideBySide)) { packageResult.Messages.Add(new ResultMessage(ResultType.Debug, ApplicationParameters.Messages.ContinueChocolateyAction)); if (continueAction != null) continueAction.Invoke(packageResult); From 1b86efd65ade14639d2dbc3edab93d1dcc22e5d8 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 28 Sep 2016 21:03:40 -0500 Subject: [PATCH 14/15] (doc) update CHANGELOG/nuspec --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ nuget/chocolatey/chocolatey.nuspec | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 655f82d1c3..ceaa22db78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,32 @@ This covers changes for the "chocolatey" and "chocolatey.lib" packages, which ar **NOTE**: If you have a licensed edition of Chocolatey ("chocolatey.extension"), refer to this in tandem with [Chocolatey Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). +## [0.10.2](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.2+is%3Aclosed) (September 30, 2016) + +We're dubbing this the "Every Joe" release in honor of a friend that just lost his fight with brain cancer. If you want to help further research, please make a donation to a cancer research association of your choosing (e.g. the [American Brain Tumor Assocation](http://www.abta.org/thank-you.html)). + +A couple of important fixes/enhancements in this release. Most of the improvements are about providing better feedback to you and fixing minor issues. The big one surrounds when packages set a download path for a file using `$env:TEMP`, choco will ensure that the file can still be found for later use. + +### BUG FIXES + +* Fix - Downloaded file is at old `$env:TEMP\chocolatey\chocolatey` location, but install calls with just `$env:TEMP\chocolatey\` location - see [#969](https://github.com/chocolatey/choco/issues/969) +* Fix - [Pro/Business] UseOriginalLocation fails when there is no 64bit file - see [#972](https://github.com/chocolatey/choco/issues/972) +* Fix - Do not use unparsed options as package names - see [#983](https://github.com/chocolatey/choco/issues/983) + +### IMPROVEMENTS + +* Start-ChocolateyProcessAsAdmin enhancements - see [#977](https://github.com/chocolatey/choco/issues/977) +* Log PowerShell function calls better - see [#976](https://github.com/chocolatey/choco/issues/976) +* Allow environment variables in some config settings - see [#971](https://github.com/chocolatey/choco/issues/971) +* [Pro/Business] Provide license type to environment variables - see [#968](https://github.com/chocolatey/choco/issues/968) +* Note that chocolateyUninstall.ps1 may no longer required in template - see [#982](https://github.com/chocolatey/choco/issues/982) +* Provide guidance when licensed only options are passed to FOSS - see [#984](https://github.com/chocolatey/choco/issues/984) +* Rollback automatically when a user cancels an operation - see [#985](https://github.com/chocolatey/choco/issues/985) +* Explain how to workaround a failing uninstall - see [#573](https://github.com/chocolatey/choco/issues/573) +* Remove extra forward slashes in url - see [#986](https://github.com/chocolatey/choco/issues/986) +* Side by side uninstall enhancements - see [#992](https://github.com/chocolatey/choco/issues/992) + + ## [0.10.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.10.1+is%3Aclosed) (September 19, 2016) We're dubbing this the "Shhh! Keep that secret please" release. We've found that when passing in passwords and other sensitive arguments, those items can end up in the logs in clear text. We've addressed this in [#948](https://github.com/chocolatey/choco/issues/948) and [#953](https://github.com/chocolatey/choco/issues/953). When it comes to passing sensitive arguments through to native installers, you can set up environment variables with those sensitive args and pass those arguments directly through to `Start-ChocolateyProcessAsAdmin`. If you prefer a better experience, the licensed version allows passing sensitive options directly through choco.exe as `--install-arguments-sensitive` and `--package-parameters-sensitive`. Read more in the [Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). diff --git a/nuget/chocolatey/chocolatey.nuspec b/nuget/chocolatey/chocolatey.nuspec index f0ab885fac..27fe621d1c 100644 --- a/nuget/chocolatey/chocolatey.nuspec +++ b/nuget/chocolatey/chocolatey.nuspec @@ -55,6 +55,32 @@ In that mess there is a link to the [PowerShell Chocolatey module reference](htt See all - https://github.com/chocolatey/choco/blob/stable/CHANGELOG.md +## 0.10.2 + +We're dubbing this the "Every Joe" release in honor of a friend that just lost his fight with brain cancer. If you want to help further research, please make a donation to a cancer research association of your choosing (e.g. the [American Brain Tumor Assocation](http://www.abta.org/thank-you.html)). + +A couple of important fixes/enhancements in this release. Most of the improvements are about providing better feedback to you and fixing minor issues. The big one surrounds when packages set a download path for a file using `$env:TEMP`, choco will ensure that the file can still be found for later use. + +### BUG FIXES + +* Fix - Downloaded file is at old `$env:TEMP\chocolatey\chocolatey` location, but install calls with just `$env:TEMP\chocolatey\` location - see [#969](https://github.com/chocolatey/choco/issues/969) +* Fix - [Pro/Business] UseOriginalLocation fails when there is no 64bit file - see [#972](https://github.com/chocolatey/choco/issues/972) +* Fix - Do not use unparsed options as package names - see [#983](https://github.com/chocolatey/choco/issues/983) + +### IMPROVEMENTS + +* Start-ChocolateyProcessAsAdmin enhancements - see [#977](https://github.com/chocolatey/choco/issues/977) +* Log PowerShell function calls better - see [#976](https://github.com/chocolatey/choco/issues/976) +* Allow environment variables in some config settings - see [#971](https://github.com/chocolatey/choco/issues/971) +* [Pro/Business] Provide license type to environment variables - see [#968](https://github.com/chocolatey/choco/issues/968) +* Note that chocolateyUninstall.ps1 may no longer required in template - see [#982](https://github.com/chocolatey/choco/issues/982) +* Provide guidance when licensed only options are passed to FOSS - see [#984](https://github.com/chocolatey/choco/issues/984) +* Rollback automatically when a user cancels an operation - see [#985](https://github.com/chocolatey/choco/issues/985) +* Explain how to workaround a failing uninstall - see [#573](https://github.com/chocolatey/choco/issues/573) +* Remove extra forward slashes in url - see [#986](https://github.com/chocolatey/choco/issues/986) +* Side by side uninstall enhancements - see [#992](https://github.com/chocolatey/choco/issues/992) + + ## 0.10.1 We're dubbing this the "Shhh! Keep that secret please" release. We've found that when passing in passwords and other sensitive arguments, those items can end up in the logs in clear text. We've addressed this in [#948](https://github.com/chocolatey/choco/issues/948) and [#953](https://github.com/chocolatey/choco/issues/953). When it comes to passing sensitive arguments through to native installers, you can set up environment variables with those sensitive args and pass those arguments directly through to `Start-ChocolateyProcessAsAdmin`. If you prefer a better experience, the licensed version allows passing sensitive options directly through choco.exe as `--install-arguments-sensitive` and `--package-parameters-sensitive`. Read more in the [Licensed CHANGELOG](https://github.com/chocolatey/choco/blob/master/CHANGELOG_LICENSED.md). From dc6c1f780a939477897356e1fa685d03e525fcf2 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 28 Sep 2016 21:04:32 -0500 Subject: [PATCH 15/15] (version) 0.10.2 --- .uppercut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.uppercut b/.uppercut index 3bfb6e79cd..7a65d21225 100644 --- a/.uppercut +++ b/.uppercut @@ -17,7 +17,7 @@ - +