aboutsummaryrefslogtreecommitdiff
path: root/src/burn
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-01-31 16:48:58 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-02-01 23:36:23 -0600
commit328d6df64373cf340628a09e52dd77ea338bc838 (patch)
treebba49ce9fe09bb2e3f178d5f1df62e5ee42cad78 /src/burn
parenta2b98c1abd6e6a1469936af5d93e4ace713b3fba (diff)
downloadwix-328d6df64373cf340628a09e52dd77ea338bc838.tar.gz
wix-328d6df64373cf340628a09e52dd77ea338bc838.tar.bz2
wix-328d6df64373cf340628a09e52dd77ea338bc838.zip
Don't uninstall package during rollback if there are dependents.
Diffstat (limited to 'src/burn')
-rw-r--r--src/burn/engine/dependency.cpp63
1 files changed, 33 insertions, 30 deletions
diff --git a/src/burn/engine/dependency.cpp b/src/burn/engine/dependency.cpp
index b783d4c4..221c7bbf 100644
--- a/src/burn/engine/dependency.cpp
+++ b/src/burn/engine/dependency.cpp
@@ -445,47 +445,44 @@ extern "C" HRESULT DependencyPlanPackageBegin(
445 ExitFunction1(hr = S_OK); 445 ExitFunction1(hr = S_OK);
446 } 446 }
447 447
448 // If we're uninstalling the package, check if any dependents are registered. 448 // Check if any dependents are registered which would prevent the package from being uninstalled.
449 if (fAttemptingUninstall) 449 // Build up a list of dependents to ignore, including the current bundle.
450 hr = GetIgnoredDependents(pPackage, pPlan, &sdIgnoredDependents);
451 ExitOnFailure(hr, "Failed to build the list of ignored dependents.");
452
453 // Skip the dependency check if "ALL" was authored for IGNOREDEPENDENCIES.
454 hr = DictKeyExists(sdIgnoredDependents, L"ALL");
455 if (E_NOTFOUND != hr)
456 {
457 ExitOnFailure(hr, "Failed to check if \"ALL\" was set in IGNOREDEPENDENCIES.");
458 }
459 else
450 { 460 {
451 // Build up a list of dependents to ignore, including the current bundle. 461 hr = S_OK;
452 hr = GetIgnoredDependents(pPackage, pPlan, &sdIgnoredDependents);
453 ExitOnFailure(hr, "Failed to build the list of ignored dependents.");
454 462
455 // Skip the dependency check if "ALL" was authored for IGNOREDEPENDENCIES. 463 for (DWORD i = 0; i < pPackage->cDependencyProviders; ++i)
456 hr = DictKeyExists(sdIgnoredDependents, L"ALL");
457 if (E_NOTFOUND != hr)
458 {
459 ExitOnFailure(hr, "Failed to check if \"ALL\" was set in IGNOREDEPENDENCIES.");
460 }
461 else
462 { 464 {
463 hr = S_OK; 465 const BURN_DEPENDENCY_PROVIDER* pProvider = pPackage->rgDependencyProviders + i;
464 466
465 for (DWORD i = 0; i < pPackage->cDependencyProviders; ++i) 467 for (DWORD j = 0; j < pProvider->cDependents; ++j)
466 { 468 {
467 const BURN_DEPENDENCY_PROVIDER* pProvider = pPackage->rgDependencyProviders + i; 469 const DEPENDENCY* pDependency = pProvider->rgDependents + j;
468 470
469 for (DWORD j = 0; j < pProvider->cDependents; ++j) 471 hr = DictKeyExists(sdIgnoredDependents, pDependency->sczKey);
472 if (E_NOTFOUND == hr)
470 { 473 {
471 const DEPENDENCY* pDependency = pProvider->rgDependents + j; 474 hr = S_OK;
472 475
473 hr = DictKeyExists(sdIgnoredDependents, pDependency->sczKey); 476 if (!fDependentBlocksUninstall)
474 if (E_NOTFOUND == hr)
475 { 477 {
476 hr = S_OK; 478 fDependentBlocksUninstall = TRUE;
477
478 if (!fDependentBlocksUninstall)
479 {
480 fDependentBlocksUninstall = TRUE;
481
482 LogId(REPORT_STANDARD, MSG_DEPENDENCY_PACKAGE_HASDEPENDENTS, pPackage->sczId);
483 }
484 479
485 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_DEPENDENT, pDependency->sczKey, LoggingStringOrUnknownIfNull(pDependency->sczName)); 480 LogId(REPORT_STANDARD, MSG_DEPENDENCY_PACKAGE_HASDEPENDENTS, pPackage->sczId);
486 } 481 }
487 ExitOnFailure(hr, "Failed to check the dictionary of ignored dependents."); 482
483 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_DEPENDENT, pDependency->sczKey, LoggingStringOrUnknownIfNull(pDependency->sczName));
488 } 484 }
485 ExitOnFailure(hr, "Failed to check the dictionary of ignored dependents.");
489 } 486 }
490 } 487 }
491 } 488 }
@@ -499,7 +496,7 @@ extern "C" HRESULT DependencyPlanPackageBegin(
499 CalculateDependencyActionStates(pPackage, &dependencyExecuteAction, &dependencyRollbackAction); 496 CalculateDependencyActionStates(pPackage, &dependencyExecuteAction, &dependencyRollbackAction);
500 497
501 // If dependents were found, change the action to not uninstall the package. 498 // If dependents were found, change the action to not uninstall the package.
502 if (fDependentBlocksUninstall) 499 if (fAttemptingUninstall && fDependentBlocksUninstall)
503 { 500 {
504 pPackage->execute = BOOTSTRAPPER_ACTION_STATE_NONE; 501 pPackage->execute = BOOTSTRAPPER_ACTION_STATE_NONE;
505 pPackage->rollback = BOOTSTRAPPER_ACTION_STATE_NONE; 502 pPackage->rollback = BOOTSTRAPPER_ACTION_STATE_NONE;
@@ -509,6 +506,12 @@ extern "C" HRESULT DependencyPlanPackageBegin(
509 } 506 }
510 else 507 else
511 { 508 {
509 // Trust the forward compatible nature of providers - don't uninstall the package during rollback if there were dependents.
510 if (fDependentBlocksUninstall && BOOTSTRAPPER_ACTION_STATE_UNINSTALL == pPackage->rollback)
511 {
512 pPackage->rollback = BOOTSTRAPPER_ACTION_STATE_NONE;
513 }
514
512 // Only plan providers when the package is current (not obsolete). 515 // Only plan providers when the package is current (not obsolete).
513 if (BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE != pPackage->currentState) 516 if (BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE != pPackage->currentState)
514 { 517 {