diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index e37d7a2810..bdd13ba2f6 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -73,7 +73,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon "AllowDowngrade - Should an attempt at downgrading be allowed? Defaults to false.", option => configuration.AllowDowngrade = option != null) .Add("m|sxs|sidebyside|side-by-side|allowmultiple|allow-multiple|allowmultipleversions|allow-multiple-versions", - "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false.", + "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false. (DEPRECATED)", option => configuration.AllowMultipleVersions = option != null) .Add("i|ignoredependencies|ignore-dependencies", "IgnoreDependencies - Ignore dependencies when installing package(s). Defaults to false.", @@ -254,6 +254,8 @@ prompt. In most cases you can still pass options and switches with one Starting in v2.0.0 the shortcut `cinst` will be removed and can not be used to install packages anymore. We recommend you make sure that you always use the full command going forward (`choco install`). + +Side by side installations has been deprecated and will be removed in v2.0.0. "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index 49df96718e..0ae1182594 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -67,7 +67,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon "Apply Package Parameters To Dependencies - Should package parameters be applied to dependent packages? Defaults to false.", option => configuration.ApplyPackageParametersToDependencies = option != null) .Add("m|sxs|sidebyside|side-by-side|allowmultiple|allow-multiple|allowmultipleversions|allow-multiple-versions", - "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false.", + "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false. (DEPRECATED)", option => configuration.AllowMultipleVersions = option != null) .Add("x|forcedependencies|force-dependencies|removedependencies|remove-dependencies", "RemoveDependencies - Uninstall dependencies when uninstalling package(s). Defaults to false.", @@ -208,6 +208,8 @@ to determine how to automatically uninstall software. Starting in v2.0.0 the shortcut `cuninst` will be removed and can not be used to uninstall packages anymore. We recommend you make sure that you always use the full command going forward (`choco uninstall`). + +Side by side installations has been deprecated and support for uninstalling such packages will be removed in v2.0.0. "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 14548d809f..710c1a3db0 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -73,7 +73,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon "AllowDowngrade - Should an attempt at downgrading be allowed? Defaults to false.", option => configuration.AllowDowngrade = option != null) .Add("m|sxs|sidebyside|side-by-side|allowmultiple|allow-multiple|allowmultipleversions|allow-multiple-versions", - "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false.", + "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false. (DEPRECATED)", option => configuration.AllowMultipleVersions = option != null) .Add("i|ignoredependencies|ignore-dependencies", "IgnoreDependencies - Ignore dependencies when upgrading package(s). Defaults to false.", @@ -285,6 +285,8 @@ prompt. In most cases you can still pass options and switches with one Starting in v2.0.0 the shortcut `cup` will be removed and can not be used to upgrade or install packages anymore. We recommend you make sure that you always use the full command going forward (`choco upgrade`). + +Side by side installations has been deprecated and will be removed in v2.0.0. "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index ca4ee25576..ada7e59d69 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -228,6 +228,8 @@ private void append_output(StringBuilder propertyValues, string append) public bool ApplyPackageParametersToDependencies { get; set; } public bool ApplyInstallArgumentsToDependencies { get; set; } public bool IgnoreDependencies { get; set; } + + [Obsolete("Side by Side installation is deprecated, and is pending removal in v2.0.0")] public bool AllowMultipleVersions { get; set; } public bool AllowDowngrade { get; set; } public bool ForceDependencies { get; set; } diff --git a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs index 14c99e518c..9066d004a4 100644 --- a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs +++ b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs @@ -16,6 +16,7 @@ namespace chocolatey.infrastructure.app.domain { + using System; using NuGet; public sealed class ChocolateyPackageInformation @@ -31,6 +32,8 @@ public ChocolateyPackageInformation(IPackage package) public string Arguments { get; set; } public SemanticVersion VersionOverride { get; set; } public bool HasSilentUninstall { get; set; } + + [Obsolete("Side by side installations are deprecated, with removal pending in v2.0.0")] public bool IsSideBySide { get; set; } public bool IsPinned { get; set; } public string ExtraInformation { get; set; } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs index 9579ed925c..f612861b9e 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs @@ -16,6 +16,7 @@ namespace chocolatey.infrastructure.app.nuget { + using System; using System.IO; using NuGet; @@ -24,8 +25,16 @@ namespace chocolatey.infrastructure.app.nuget public sealed class ChocolateyPackagePathResolver : DefaultPackagePathResolver { private readonly IFileSystem _nugetFileSystem; + + [Obsolete("Side by Side installations are deprecated, and is pending removal in v2.0.0")] public bool UseSideBySidePaths { get; set; } + public ChocolateyPackagePathResolver(IFileSystem nugetFileSystem) + : this(nugetFileSystem, useSideBySidePaths: false) + { + } + + [Obsolete("Initializing using side by side installation enabled is deprecated. Use overload without useSideBySidePaths instead.")] public ChocolateyPackagePathResolver(IFileSystem nugetFileSystem, bool useSideBySidePaths) : base(nugetFileSystem, useSideBySidePaths) { @@ -47,6 +56,7 @@ public override string GetPackageDirectory(string packageId, SemanticVersion ver return GetPackageDirectory(packageId, version, UseSideBySidePaths); } + [Obsolete("Side by Side installations are deprecated, and is pending removal in v2.0.0")] public string GetPackageDirectory(string packageId, SemanticVersion version, bool useVersionInPath) { string directory = packageId; diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs index 07a1e7706a..9971e24fea 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs @@ -17,6 +17,7 @@ namespace chocolatey.infrastructure.app.services { using System; + using System.Collections.Generic; using System.IO; using System.Text; using configuration; @@ -42,6 +43,10 @@ public class ChocolateyPackageInformationService : IChocolateyPackageInformation private const string EXTRA_FILE = ".extra"; private const string VERSION_OVERRIDE_FILE = ".version"; + // We need to store the package identifiers we have warned about + // to prevent duplicated outputs. + private HashSet _deprecationWarning = new HashSet(); + public ChocolateyPackageInformationService(IFileSystem fileSystem, IRegistryService registryService, IFilesService filesService) { _fileSystem = fileSystem; @@ -141,6 +146,19 @@ has errored attempting to read it. This file will be renamed to var extraInfoFile = _fileSystem.combine_paths(pkgStorePath, EXTRA_FILE); if (_fileSystem.file_exists(extraInfoFile)) packageInformation.ExtraInformation = _fileSystem.read_file(extraInfoFile); + if (packageInformation.IsSideBySide && !_deprecationWarning.Contains(package.Id)) + { + var logger = _config.RegularOutput ? + logging.ChocolateyLoggers.Important : + logging.ChocolateyLoggers.LogFileOnly; + + this.Log().Warn(logger, @" +{0} has been installed as a side by side installation. +Side by side installations are deprecated and is pending removal in v2.0.0.", package.Id); + + _deprecationWarning.Add(package.Id); + } + var versionOverrideFile = _fileSystem.combine_paths(pkgStorePath, VERSION_OVERRIDE_FILE); if (_fileSystem.file_exists(versionOverrideFile)) { diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index f46986f461..218fc6277d 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -573,6 +573,11 @@ private string capture_arguments(ChocolateyConfiguration config, PackageResult p public virtual ConcurrentDictionary install_run(ChocolateyConfiguration config) { + if (config.AllowMultipleVersions) + { + this.Log().Warn(ChocolateyLoggers.Important, "Installing the same package with multiple versions is deprecated and will be removed in v2.0.0."); + } + this.Log().Info(is_packages_config_file(config.PackageNames) ? @"Installing from config file:" : @"Installing the following packages:"); this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames)); @@ -808,6 +813,11 @@ public void upgrade_noop(ChocolateyConfiguration config) public virtual ConcurrentDictionary upgrade_run(ChocolateyConfiguration config) { + if (config.AllowMultipleVersions) + { + this.Log().Warn(ChocolateyLoggers.Important, "Upgrading the same package with multiple versions is deprecated and will be removed in v2.0.0."); + } + this.Log().Info(@"Upgrading the following packages:"); this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames)); diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 2864765bea..29364acaf8 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -951,6 +951,15 @@ public virtual ConcurrentDictionary get_outdated(Chocolat packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); this.Log().Info("{0}|{1}|{2}|{3}".format_with(installedPackage.Id, installedPackage.Version, latestPackage.Version, isPinned.to_string().to_lower())); + + if (pkgInfo.IsSideBySide) + { + var deprecationMessage = @" +{0} v{1} has been installed as a side by side installation. +Side by side installations are deprecated and is pending removal in v2.0.0".format_with(installedPackage.Id, installedPackage.Version); + + packageResult.Messages.Add(new ResultMessage(ResultType.Warn, deprecationMessage)); + } } return outdatedPackages; @@ -1267,6 +1276,8 @@ public virtual ConcurrentDictionary uninstall_run(Chocola { var pkg = e.Package; + // TODO: Removal special handling for SxS packages once we hit v2.0.0 + // this section fires twice sometimes, like for older packages in a sxs install... var packageResult = packageUninstalls.GetOrAdd(pkg.Id.to_lower() + "." + pkg.Version.to_string(), new PackageResult(pkg, e.InstallPath)); packageResult.InstallLocation = e.InstallPath;