Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/burn/engine/plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,30 +376,30 @@ extern "C" HRESULT PlanDefaultPackageRequestState(
break;
}
}
else if (BOOTSTRAPPER_RELATION_PATCH == relationType && BURN_PACKAGE_TYPE_MSP == packageType)
{
// For patch related bundles, only install a patch if currently absent during install, modify, or repair.
if (BOOTSTRAPPER_PACKAGE_STATE_ABSENT != currentState)
{
*pRequestState = BOOTSTRAPPER_REQUEST_STATE_NONE;
}
else if (BOOTSTRAPPER_ACTION_INSTALL == action ||
BOOTSTRAPPER_ACTION_MODIFY == action ||
BOOTSTRAPPER_ACTION_REPAIR == action)
{
*pRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT;
}
}
else // pick the best option for the action state and install condition.
{
hr = GetActionDefaultRequestState(action, currentState, &defaultRequestState);
ExitOnFailure(hr, "Failed to get default request state for action.");

if (BOOTSTRAPPER_ACTION_UNINSTALL != action && BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL != action)
{
if (BOOTSTRAPPER_RELATION_PATCH == relationType && BURN_PACKAGE_TYPE_MSP == packageType)
{
// For patch related bundles, only install a patch if currently absent during install, modify, or repair.
if (BOOTSTRAPPER_PACKAGE_STATE_ABSENT != currentState)
{
defaultRequestState = BOOTSTRAPPER_REQUEST_STATE_NONE;
}
else if (BOOTSTRAPPER_ACTION_INSTALL == action ||
BOOTSTRAPPER_ACTION_MODIFY == action ||
BOOTSTRAPPER_ACTION_REPAIR == action)
{
defaultRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT;
}
}
// If we're not doing an uninstall, use the install condition
// to determine whether to use the default request state or make the package absent.
if (BOOTSTRAPPER_PACKAGE_CONDITION_FALSE == installCondition)
else if (BOOTSTRAPPER_PACKAGE_CONDITION_FALSE == installCondition)
{
defaultRequestState = BOOTSTRAPPER_REQUEST_STATE_ABSENT;
}
Expand Down
123 changes: 123 additions & 0 deletions src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,129 @@ public void CanMinorUpgradeDependencyPackageFromPatchBundleThenUninstallToRestor
}
}

[RuntimeFact]
public void CanUninstallPatchBundleFromARP()
{
var originalVersion = "1.0.0.0";
var patchedVersion = "1.0.1.0";
var testRegistryValue = "PackageA";

var packageA = this.CreatePackageInstaller("PackageAv1");
var packageEv1 = this.CreatePackageInstaller("PackageEv1");
var packageEv101 = this.CreatePackageInstaller("PackageEv1_0_1");
var bundleJ = this.CreateBundleInstaller("BundleJ");
var bundleJ_Patch = this.CreateBundleInstaller("BundleJ_Patch");

packageA.VerifyInstalled(false);
packageEv1.VerifyInstalledWithVersion(false);
packageEv101.VerifyInstalledWithVersion(false);

bundleJ.Install();
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ.VerifyRegisteredAndInPackageCache();

packageA.VerifyInstalled(true);
packageA.VerifyTestRegistryValue(testRegistryValue, originalVersion);
packageEv1.VerifyInstalledWithVersion(true);
}

bundleJ_Patch.Install();
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ_Patch.VerifyRegisteredAndInPackageCache();

packageA.VerifyInstalled(true);
packageA.VerifyTestRegistryValue(testRegistryValue, patchedVersion);
packageEv1.VerifyInstalledWithVersion(false);
packageEv101.VerifyInstalledWithVersion(true);
}

bundleJ_Patch.Uninstall(0, "-burn.related.patch");
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ_Patch.VerifyUnregisteredAndRemovedFromPackageCache();
packageA.VerifyTestRegistryValue(testRegistryValue, originalVersion);

// Uninstalling a patch bundle does not uninstall the bundle patch updated msi
//packageEv101.VerifyInstalledWithVersion(false);
}

bundleJ.Uninstall();
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ.VerifyUnregisteredAndRemovedFromPackageCache();
bundleJ_Patch.VerifyUnregisteredAndRemovedFromPackageCache();

packageA.VerifyInstalled(false);
packageEv1.VerifyInstalledWithVersion(false);

// Uninstalling a patch bundle does not uninstall the bundle patch updated msi
// https://github.com/wixtoolset/issues/issues/9138
if (packageEv101.IsInstalledWithVersion())
{
packageEv101.UninstallProduct();
}
}
}
[RuntimeFact(Skip = "https://github.com/wixtoolset/issues/issues/9138")]
public void CanUninstallPatchBundleFromARPRemoveUpdatedMSI()
{
var originalVersion = "1.0.0.0";
var patchedVersion = "1.0.1.0";
var testRegistryValue = "PackageA";

var packageA = this.CreatePackageInstaller("PackageAv1");
var packageEv1 = this.CreatePackageInstaller("PackageEv1");
var packageEv101 = this.CreatePackageInstaller("PackageEv1_0_1");
var bundleJ = this.CreateBundleInstaller("BundleJ");
var bundleJ_Patch = this.CreateBundleInstaller("BundleJ_Patch");

packageA.VerifyInstalled(false);
packageEv1.VerifyInstalledWithVersion(false);
packageEv101.VerifyInstalledWithVersion(false);

bundleJ.Install();
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ.VerifyRegisteredAndInPackageCache();

packageA.VerifyInstalled(true);
packageA.VerifyTestRegistryValue(testRegistryValue, originalVersion);
packageEv1.VerifyInstalledWithVersion(true);
}

bundleJ_Patch.Install();
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ_Patch.VerifyRegisteredAndInPackageCache();

packageA.VerifyInstalled(true);
packageA.VerifyTestRegistryValue(testRegistryValue, patchedVersion);
packageEv1.VerifyInstalledWithVersion(false);
packageEv101.VerifyInstalledWithVersion(true);
}

bundleJ_Patch.Uninstall(0, "-burn.related.patch");
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ_Patch.VerifyUnregisteredAndRemovedFromPackageCache();
packageA.VerifyTestRegistryValue(testRegistryValue, originalVersion);
packageEv101.VerifyInstalledWithVersion(false);
}

bundleJ.Uninstall();
if (this.SupportAddonAndPatchRelatedBundles)
{
bundleJ.VerifyUnregisteredAndRemovedFromPackageCache();
bundleJ_Patch.VerifyUnregisteredAndRemovedFromPackageCache();

packageA.VerifyInstalled(false);
packageEv1.VerifyInstalledWithVersion(false);
packageEv101.VerifyInstalledWithVersion(false);
}
}

[RuntimeFact]
public void CanUninstallBaseWithAddOnsWhenAllSharePackages()
{
Expand Down