Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  Remove extra '='
  (spec) fix tests
  (log) auto uninstaller enhancements messaging
  (GH-945) Fix - Fails Installs Running Without User
  • Loading branch information
ferventcoder committed Sep 18, 2016
2 parents 19cdf4b + e2ce576 commit 8fb7db1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Install-ChocolateyPackage 'mono' 'exe' '/SILENT' `
Install-ChocolateyPackage 'ruby.devkit' 'exe' '/SILENT' `
'http://cdn.rubyinstaller.org/archives/devkits/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe' `
'http://cdn.rubyinstaller.org/archives/devkits/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' `
-checksum '9383f12958aafc425923e322460a84de' -checksumType = 'md5' `
-checksum '9383f12958aafc425923e322460a84de' -checksumType 'md5' `
-checksum64 'ce99d873c1acc8bffc639bd4e764b849'
.EXAMPLE
Expand Down
3 changes: 3 additions & 0 deletions src/chocolatey.tests.integration/NUnitSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ private static void fix_application_parameter_variables(Container container)
field = typeof(ApplicationParameters).GetField("ChocolateyPackageInfoStoreLocation");
field.SetValue(null, fileSystem.combine_paths(ApplicationParameters.InstallLocation, ".chocolatey"));

field = typeof(ApplicationParameters).GetField("LockTransactionalInstallFiles");
field.SetValue(null, false);

// we need to speed up specs a bit, so only try filesystem locking operations twice
field = fileSystem.GetType().GetField("TIMES_TO_TRY_OPERATION", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public override void Because()
[Fact]
public void visible_file_should_now_be_hidden()
{
(FileSystem.get_file_info_for(SourceFile).Attributes & FileAttributes.Hidden).ShouldEqual(FileAttributes.Hidden);
((FileAttributes)FileSystem.get_file_info_for(SourceFile).Attributes & FileAttributes.Hidden).ShouldEqual(FileAttributes.Hidden);
}

public override void AfterObservations()
Expand Down Expand Up @@ -235,7 +235,7 @@ public override void Because()
[Fact]
public void readonly_file_should_no_longer_be_readonly()
{
(FileSystem.get_file_info_for(SourceFile).Attributes & FileAttributes.ReadOnly).ShouldNotEqual(FileAttributes.ReadOnly);
((FileAttributes)FileSystem.get_file_info_for(SourceFile).Attributes & FileAttributes.ReadOnly).ShouldNotEqual(FileAttributes.ReadOnly);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/chocolatey/infrastructure.app/ApplicationParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public static class ApplicationParameters
public static readonly string ChocolateyConfigFileResource = @"chocolatey.infrastructure.app.configuration.chocolatey.config";
public static readonly string GlobalConfigFileLocation = _fileSystem.combine_paths(InstallLocation, "config", "chocolatey.config");
public static readonly string LicenseFileLocation = _fileSystem.combine_paths(InstallLocation, "license", "chocolatey.license.xml");
public static readonly string UserLicenseFileLocation = _fileSystem.combine_paths(System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile, System.Environment.SpecialFolderOption.DoNotVerify), "chocolatey.license.xml");
public static readonly string UserProfilePath = !string.IsNullOrWhiteSpace(System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile, System.Environment.SpecialFolderOption.DoNotVerify)) ?
System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile, System.Environment.SpecialFolderOption.DoNotVerify)
: CommonAppDataChocolatey;
public static readonly string UserLicenseFileLocation = _fileSystem.combine_paths(UserProfilePath, "chocolatey.license.xml");
public static readonly string LicensedAssemblyLocation = _fileSystem.combine_paths(InstallLocation, "extensions", "chocolatey", "chocolatey.licensed.dll");
public static readonly string LicensedComponentRegistry = @"chocolatey.licensed.infrastructure.app.registration.ContainerBinding";
public static readonly string LicensedConfigurationBuilder = @"chocolatey.licensed.infrastructure.app.builders.ConfigurationBuilder";
Expand Down Expand Up @@ -107,6 +110,7 @@ public static class Environment
public static readonly string HashProviderFileTooBig = "UnableToDetectChanges_FileTooBig";
public static readonly string HashProviderFileLocked = "UnableToDetectChanges_FileLocked";

public static readonly bool LockTransactionalInstallFiles = true;
public static readonly string PackagePendingFileName = ".chocolateyPending";

public static class Tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void run(PackageResult packageResult, ChocolateyConfiguration config)
this.Log().Info(" Running auto uninstaller...");
if (WaitForCleanup)
{
this.Log().Debug("Sleeping for {0} seconds to allow Windows to finish cleaning up.".format_with(SLEEP_TIME));
this.Log().Debug(" Sleeping for {0} seconds to allow Windows to finish cleaning up.".format_with(SLEEP_TIME));
Thread.Sleep((int)TimeSpan.FromSeconds(SLEEP_TIME).TotalMilliseconds);
}

Expand Down Expand Up @@ -123,6 +123,15 @@ public void run(PackageResult packageResult, ChocolateyConfiguration config)

if (!key.HasQuietUninstall && installer.GetType() == typeof(CustomInstaller))
{
if (!config.Information.IsLicensedVersion)
{
this.Log().Warn(@"
Did you know licensed versions of Chocolatey are 95% effective with
Automatic Uninstaller due to licensed enhancements and Package
Synchronizer?
");
}

var skipUninstaller = true;

var timeout = config.PromptForConfirmation ? 0 : 30;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ An organization needed total software management life cycle automation.
next!
https://chocolatey.org/compare",
@"
Did you know that Synchronizer and AutoUninstaller enhancements in
licensed versions provide up to 95% effectiveness at removing system
Did you know that Package Synchronizer and AutoUninstaller enhancements
in licensed versions are up to 95% effective in removing system
installed software without an uninstall script? Find out more at
https://chocolatey.org/compare",
@"
Expand All @@ -93,7 +93,8 @@ system admins into something amazing! Singlehandedly solve your
};
private const string PRO_BUSINESS_LIST_MESSAGE = @"
Did you know Pro / Business automatically syncs with Programs and
Features? Find out more at https://chocolatey.org/compare";
Features? Learn more about Package Synchronizer at
https://chocolatey.org/compare";

private readonly string _shutdownExe = Environment.ExpandEnvironmentVariables("%systemroot%\\System32\\shutdown.exe");

Expand Down Expand Up @@ -1160,7 +1161,10 @@ public void set_pending(PackageResult packageResult, ChocolateyConfiguration con

var pendingFile = _fileSystem.combine_paths(packageDirectory, ApplicationParameters.PackagePendingFileName);
_fileSystem.write_file(pendingFile, "{0}".format_with(packageResult.Name));
_pendingLocks.Add(packageResult.Name.to_lower(), _fileSystem.open_file_exclusive(pendingFile));
if (ApplicationParameters.LockTransactionalInstallFiles)
{
_pendingLocks.Add(packageResult.Name.to_lower(), _fileSystem.open_file_exclusive(pendingFile));
}
}

public void remove_pending(PackageResult packageResult, ChocolateyConfiguration config)
Expand Down
22 changes: 15 additions & 7 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,21 @@ private void remove_cache_for_package(ChocolateyConfiguration config, IPackage i
/// <param name="installedPackage">The installed package.</param>
private void remove_nuget_cache_for_package(IPackage installedPackage)
{
var nugetCachedFile = _fileSystem.combine_paths(Environment.GetEnvironmentVariable("LocalAppData"), "NuGet", "Cache", "{0}.{1}.nupkg".format_with(installedPackage.Id, installedPackage.Version.to_string()));
if (_fileSystem.file_exists(nugetCachedFile))
{
FaultTolerance.try_catch_with_logging_exception(
() => _fileSystem.delete_file(nugetCachedFile),
"Unable to removed cached NuGet package file");
}
var localAppData = Environment.GetEnvironmentVariable("LocalAppData");
if (string.IsNullOrWhiteSpace(localAppData)) return;

FaultTolerance.try_catch_with_logging_exception(
() =>
{
var nugetCachedFile = _fileSystem.combine_paths(localAppData, "NuGet", "Cache", "{0}.{1}.nupkg".format_with(installedPackage.Id, installedPackage.Version.to_string()));
if (_fileSystem.file_exists(nugetCachedFile))
{

_fileSystem.delete_file(nugetCachedFile);
}
},
"Unable to removed cached NuGet package file");

}

public void uninstall_noop(ChocolateyConfiguration config, Action<PackageResult> continueAction)
Expand Down

0 comments on commit 8fb7db1

Please sign in to comment.