aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/mspengine.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-05-04 19:25:07 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-05-11 19:11:19 -0500
commit27c6decae94536cae338731b6cb765aa92776486 (patch)
treecabfb05464fdc64e30597da28a54113fc3a62da1 /src/burn/engine/mspengine.cpp
parenta2f2036c8598efcb434eebeeacd7ede84ab60dfe (diff)
downloadwix-27c6decae94536cae338731b6cb765aa92776486.tar.gz
wix-27c6decae94536cae338731b6cb765aa92776486.tar.bz2
wix-27c6decae94536cae338731b6cb765aa92776486.zip
Put back the rollback cache package functionality and fix its bugs.
#3719, #4711, #5750
Diffstat (limited to 'src/burn/engine/mspengine.cpp')
-rw-r--r--src/burn/engine/mspengine.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/burn/engine/mspengine.cpp b/src/burn/engine/mspengine.cpp
index 6d58d324..4a82598f 100644
--- a/src/burn/engine/mspengine.cpp
+++ b/src/burn/engine/mspengine.cpp
@@ -57,8 +57,7 @@ static HRESULT PlanTargetProduct(
57 __in BURN_VARIABLES* pVariables, 57 __in BURN_VARIABLES* pVariables,
58 __in BOOTSTRAPPER_ACTION_STATE actionState, 58 __in BOOTSTRAPPER_ACTION_STATE actionState,
59 __in BURN_PACKAGE* pPackage, 59 __in BURN_PACKAGE* pPackage,
60 __in BURN_MSPTARGETPRODUCT* pTargetProduct, 60 __in BURN_MSPTARGETPRODUCT* pTargetProduct
61 __in_opt HANDLE hCacheEvent
62 ); 61 );
63 62
64 63
@@ -504,21 +503,11 @@ extern "C" HRESULT MspEnginePlanAddPackage(
504 __in BURN_PACKAGE* pPackage, 503 __in BURN_PACKAGE* pPackage,
505 __in BURN_PLAN* pPlan, 504 __in BURN_PLAN* pPlan,
506 __in BURN_LOGGING* pLog, 505 __in BURN_LOGGING* pLog,
507 __in BURN_VARIABLES* pVariables, 506 __in BURN_VARIABLES* pVariables
508 __in_opt HANDLE hCacheEvent
509 ) 507 )
510{ 508{
511 HRESULT hr = S_OK; 509 HRESULT hr = S_OK;
512 510
513 // TODO: need to handle the case where this patch adds itself to an earlier patch's list of target products. That would
514 // essentially bump this patch earlier in the plan and we need to make sure this patch is downloaded.
515 // add wait for cache
516 if (hCacheEvent)
517 {
518 hr = PlanExecuteCacheSyncAndRollback(pPlan, pPackage, hCacheEvent);
519 ExitOnFailure(hr, "Failed to plan package cache syncpoint");
520 }
521
522 hr = DependencyPlanPackage(NULL, pPackage, pPlan); 511 hr = DependencyPlanPackage(NULL, pPackage, pPlan);
523 ExitOnFailure(hr, "Failed to plan package dependency actions."); 512 ExitOnFailure(hr, "Failed to plan package dependency actions.");
524 513
@@ -536,13 +525,13 @@ extern "C" HRESULT MspEnginePlanAddPackage(
536 525
537 if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->execute) 526 if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->execute)
538 { 527 {
539 hr = PlanTargetProduct(display, pUserExperience, FALSE, pPlan, pLog, pVariables, pTargetProduct->execute, pPackage, pTargetProduct, hCacheEvent); 528 hr = PlanTargetProduct(display, pUserExperience, FALSE, pPlan, pLog, pVariables, pTargetProduct->execute, pPackage, pTargetProduct);
540 ExitOnFailure(hr, "Failed to plan target product."); 529 ExitOnFailure(hr, "Failed to plan target product.");
541 } 530 }
542 531
543 if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->rollback) 532 if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->rollback)
544 { 533 {
545 hr = PlanTargetProduct(display, pUserExperience, TRUE, pPlan, pLog, pVariables, pTargetProduct->rollback, pPackage, pTargetProduct, hCacheEvent); 534 hr = PlanTargetProduct(display, pUserExperience, TRUE, pPlan, pLog, pVariables, pTargetProduct->rollback, pPackage, pTargetProduct);
546 ExitOnFailure(hr, "Failed to plan rollback target product."); 535 ExitOnFailure(hr, "Failed to plan rollback target product.");
547 } 536 }
548 } 537 }
@@ -1089,8 +1078,7 @@ static HRESULT PlanTargetProduct(
1089 __in BURN_VARIABLES* pVariables, 1078 __in BURN_VARIABLES* pVariables,
1090 __in BOOTSTRAPPER_ACTION_STATE actionState, 1079 __in BOOTSTRAPPER_ACTION_STATE actionState,
1091 __in BURN_PACKAGE* pPackage, 1080 __in BURN_PACKAGE* pPackage,
1092 __in BURN_MSPTARGETPRODUCT* pTargetProduct, 1081 __in BURN_MSPTARGETPRODUCT* pTargetProduct
1093 __in_opt HANDLE hCacheEvent
1094 ) 1082 )
1095{ 1083{
1096 HRESULT hr = S_OK; 1084 HRESULT hr = S_OK;
@@ -1153,16 +1141,17 @@ static HRESULT PlanTargetProduct(
1153 } 1141 }
1154 else 1142 else
1155 { 1143 {
1156 if (!fRollback && hCacheEvent) 1144 if (!fRollback && pPackage->hCacheEvent)
1157 { 1145 {
1158 // Since a previouse MSP target action is being updated with the new MSP, 1146 // TODO: need to properly handle rolling back the caching of the package since this causes cache and execute plans to get out of sync.
1147 // Since a previous MSP target action is being updated with the new MSP,
1159 // insert a wait syncpoint to before this action since we need to cache the current MSI before using it. 1148 // insert a wait syncpoint to before this action since we need to cache the current MSI before using it.
1160 BURN_EXECUTE_ACTION* pWaitSyncPointAction = NULL; 1149 BURN_EXECUTE_ACTION* pWaitSyncPointAction = NULL;
1161 hr = PlanInsertExecuteAction(dwInsertSequence, pPlan, &pWaitSyncPointAction); 1150 hr = PlanInsertExecuteAction(dwInsertSequence, pPlan, &pWaitSyncPointAction);
1162 ExitOnFailure(hr, "Failed to insert execute action."); 1151 ExitOnFailure(hr, "Failed to insert execute action.");
1163 1152
1164 pWaitSyncPointAction->type = BURN_EXECUTE_ACTION_TYPE_WAIT_SYNCPOINT; 1153 pWaitSyncPointAction->type = BURN_EXECUTE_ACTION_TYPE_WAIT_CACHE_PACKAGE;
1165 pWaitSyncPointAction->syncpoint.hEvent = hCacheEvent; 1154 pWaitSyncPointAction->waitCachePackage.pPackage = pPackage;
1166 1155
1167 // Since we inserted an action before the MSP target action that we will be updating, need to update the pointer. 1156 // Since we inserted an action before the MSP target action that we will be updating, need to update the pointer.
1168 pAction = pPlan->rgExecuteActions + (dwInsertSequence + 1); 1157 pAction = pPlan->rgExecuteActions + (dwInsertSequence + 1);