diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-02 18:09:58 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-04 22:16:10 -0600 |
commit | fd8c2b0899bfbce07386af245c04eb21dc01cbdf (patch) | |
tree | 33d928124b0028729916189ddb9f239a9574c75d /src/engine/core.cpp | |
parent | 39725a1a6d1c72a6748bd3c306af32bcae6dbf8f (diff) | |
download | wix-fd8c2b0899bfbce07386af245c04eb21dc01cbdf.tar.gz wix-fd8c2b0899bfbce07386af245c04eb21dc01cbdf.tar.bz2 wix-fd8c2b0899bfbce07386af245c04eb21dc01cbdf.zip |
Update the logic for determining when the bundle should be registered.
The basic rule is that if a non-permanent package is present at the end of the chain, then the bundle should be registered. If no non-permanent packages are present at the end of the chain, then the bundle should not be registered. This required tracking what actually happened with each package during Apply.
Include cache status in registration calculation.
Include dependency ref-counting when determining whether the bundle should be registered.
Diffstat (limited to 'src/engine/core.cpp')
-rw-r--r-- | src/engine/core.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/engine/core.cpp b/src/engine/core.cpp index a4c118a3..36471e93 100644 --- a/src/engine/core.cpp +++ b/src/engine/core.cpp | |||
@@ -331,6 +331,8 @@ extern "C" HRESULT CoreDetect( | |||
331 | } | 331 | } |
332 | 332 | ||
333 | pPackage->currentState = BOOTSTRAPPER_PACKAGE_STATE_UNKNOWN; | 333 | pPackage->currentState = BOOTSTRAPPER_PACKAGE_STATE_UNKNOWN; |
334 | pPackage->cacheRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_UNKNOWN; | ||
335 | pPackage->installRegistrationState = BURN_PACKAGE_REGISTRATION_STATE_UNKNOWN; | ||
334 | } | 336 | } |
335 | } | 337 | } |
336 | 338 | ||
@@ -342,7 +344,7 @@ extern "C" HRESULT CoreDetect( | |||
342 | { | 344 | { |
343 | pPackage = pEngineState->packages.rgPackages + iPackage; | 345 | pPackage = pEngineState->packages.rgPackages + iPackage; |
344 | 346 | ||
345 | LogId(REPORT_STANDARD, MSG_DETECTED_PACKAGE, pPackage->sczId, LoggingPackageStateToString(pPackage->currentState), LoggingCacheStateToString(pPackage->cache)); | 347 | LogId(REPORT_STANDARD, MSG_DETECTED_PACKAGE, pPackage->sczId, LoggingPackageStateToString(pPackage->currentState), LoggingCacheStateToString(pPackage->cache), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->installRegistrationState), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->cacheRegistrationState)); |
346 | 348 | ||
347 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type) | 349 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type) |
348 | { | 350 | { |
@@ -565,7 +567,6 @@ extern "C" HRESULT CoreApply( | |||
565 | BOOL fApplyInitialize = FALSE; | 567 | BOOL fApplyInitialize = FALSE; |
566 | BOOL fElevated = FALSE; | 568 | BOOL fElevated = FALSE; |
567 | BOOL fRegistered = FALSE; | 569 | BOOL fRegistered = FALSE; |
568 | BOOL fKeepRegistration = pEngineState->plan.fKeepRegistrationDefault; | ||
569 | BOOL fRollback = FALSE; | 570 | BOOL fRollback = FALSE; |
570 | BOOL fSuspend = FALSE; | 571 | BOOL fSuspend = FALSE; |
571 | BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; | 572 | BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; |
@@ -652,9 +653,9 @@ extern "C" HRESULT CoreApply( | |||
652 | // Register. | 653 | // Register. |
653 | if (pEngineState->plan.fRegister) | 654 | if (pEngineState->plan.fRegister) |
654 | { | 655 | { |
656 | fRegistered = TRUE; | ||
655 | hr = ApplyRegister(pEngineState); | 657 | hr = ApplyRegister(pEngineState); |
656 | ExitOnFailure(hr, "Failed to register bundle."); | 658 | ExitOnFailure(hr, "Failed to register bundle."); |
657 | fRegistered = TRUE; | ||
658 | } | 659 | } |
659 | 660 | ||
660 | // Cache. | 661 | // Cache. |
@@ -681,7 +682,7 @@ extern "C" HRESULT CoreApply( | |||
681 | // Execute. | 682 | // Execute. |
682 | if (pEngineState->plan.cExecuteActions) | 683 | if (pEngineState->plan.cExecuteActions) |
683 | { | 684 | { |
684 | hr = ApplyExecute(pEngineState, hCacheThread, &cOverallProgressTicks, &fKeepRegistration, &fRollback, &fSuspend, &restart); | 685 | hr = ApplyExecute(pEngineState, hCacheThread, &cOverallProgressTicks, &fRollback, &fSuspend, &restart); |
685 | UserExperienceExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that execute completed. | 686 | UserExperienceExecutePhaseComplete(&pEngineState->userExperience, hr); // signal that execute completed. |
686 | } | 687 | } |
687 | 688 | ||
@@ -711,7 +712,7 @@ LExit: | |||
711 | // Unregister. | 712 | // Unregister. |
712 | if (fRegistered) | 713 | if (fRegistered) |
713 | { | 714 | { |
714 | ApplyUnregister(pEngineState, FAILED(hr) || fRollback, fKeepRegistration || pEngineState->plan.fDisallowRemoval, fSuspend, restart); | 715 | ApplyUnregister(pEngineState, FAILED(hr) || fRollback, fSuspend, restart); |
715 | } | 716 | } |
716 | 717 | ||
717 | if (fElevated) | 718 | if (fElevated) |
@@ -1611,6 +1612,11 @@ static HRESULT DetectPackagePayloadsCached( | |||
1611 | 1612 | ||
1612 | pPackage->cache = cache; | 1613 | pPackage->cache = cache; |
1613 | 1614 | ||
1615 | if (pPackage->fCanAffectRegistration) | ||
1616 | { | ||
1617 | pPackage->cacheRegistrationState = BURN_CACHE_STATE_NONE < pPackage->cache ? BURN_PACKAGE_REGISTRATION_STATE_PRESENT : BURN_PACKAGE_REGISTRATION_STATE_ABSENT; | ||
1618 | } | ||
1619 | |||
1614 | LExit: | 1620 | LExit: |
1615 | ReleaseStr(sczPayloadCachePath); | 1621 | ReleaseStr(sczPayloadCachePath); |
1616 | ReleaseStr(sczCachePath); | 1622 | ReleaseStr(sczCachePath); |
@@ -1703,7 +1709,7 @@ static void LogPackages( | |||
1703 | const DWORD iPackage = (BOOTSTRAPPER_ACTION_UNINSTALL == action) ? pPackages->cPackages - 1 - i : i; | 1709 | const DWORD iPackage = (BOOTSTRAPPER_ACTION_UNINSTALL == action) ? pPackages->cPackages - 1 - i : i; |
1704 | const BURN_PACKAGE* pPackage = &pPackages->rgPackages[iPackage]; | 1710 | const BURN_PACKAGE* pPackage = &pPackages->rgPackages[iPackage]; |
1705 | 1711 | ||
1706 | LogId(REPORT_STANDARD, MSG_PLANNED_PACKAGE, pPackage->sczId, LoggingPackageStateToString(pPackage->currentState), LoggingRequestStateToString(pPackage->defaultRequested), LoggingRequestStateToString(pPackage->requested), LoggingActionStateToString(pPackage->execute), LoggingActionStateToString(pPackage->rollback), LoggingBoolToString(pPackage->fAcquire), LoggingBoolToString(pPackage->fUncache), LoggingDependencyActionToString(pPackage->dependencyExecute)); | 1712 | LogId(REPORT_STANDARD, MSG_PLANNED_PACKAGE, pPackage->sczId, LoggingPackageStateToString(pPackage->currentState), LoggingRequestStateToString(pPackage->defaultRequested), LoggingRequestStateToString(pPackage->requested), LoggingActionStateToString(pPackage->execute), LoggingActionStateToString(pPackage->rollback), LoggingBoolToString(pPackage->fAcquire), LoggingBoolToString(pPackage->fUncache), LoggingDependencyActionToString(pPackage->dependencyExecute), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->expectedInstallRegistrationState), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->expectedCacheRegistrationState)); |
1707 | } | 1713 | } |
1708 | 1714 | ||
1709 | // Display related bundles last if caching, installing, modifying, or repairing. | 1715 | // Display related bundles last if caching, installing, modifying, or repairing. |