diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-13 23:45:32 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-14 14:53:29 -0500 |
commit | 4cd1c4e06145434ca940ac828772dc47b9d9738e (patch) | |
tree | a754d685039173c63303dc6d0d8b1a2bf3ab506b /src/burn/engine/plan.cpp | |
parent | 89adb2e3cc232b11b28e5bdeccb0c522c8124a29 (diff) | |
download | wix-4cd1c4e06145434ca940ac828772dc47b9d9738e.tar.gz wix-4cd1c4e06145434ca940ac828772dc47b9d9738e.tar.bz2 wix-4cd1c4e06145434ca940ac828772dc47b9d9738e.zip |
Allow the BA to override the bundle relation type during plan.
Diffstat (limited to 'src/burn/engine/plan.cpp')
-rw-r--r-- | src/burn/engine/plan.cpp | 161 |
1 files changed, 124 insertions, 37 deletions
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index c9337df5..d3cc60f1 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
@@ -511,7 +511,7 @@ extern "C" HRESULT PlanForwardCompatibleBundles( | |||
511 | 511 | ||
512 | fIgnoreBundle = fRecommendIgnore; | 512 | fIgnoreBundle = fRecommendIgnore; |
513 | 513 | ||
514 | hr = UserExperienceOnPlanForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); | 514 | hr = UserExperienceOnPlanForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->detectRelationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); |
515 | ExitOnRootFailure(hr, "BA aborted plan forward compatible bundle."); | 515 | ExitOnRootFailure(hr, "BA aborted plan forward compatible bundle."); |
516 | 516 | ||
517 | if (!fIgnoreBundle) | 517 | if (!fIgnoreBundle) |
@@ -621,7 +621,8 @@ extern "C" HRESULT PlanRegistration( | |||
621 | { | 621 | { |
622 | const BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; | 622 | const BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; |
623 | 623 | ||
624 | if (BOOTSTRAPPER_RELATION_DEPENDENT == pRelatedBundle->relationType) | 624 | if (BOOTSTRAPPER_RELATION_DEPENDENT_ADDON == pRelatedBundle->planRelationType || |
625 | BOOTSTRAPPER_RELATION_DEPENDENT_PATCH == pRelatedBundle->planRelationType) | ||
625 | { | 626 | { |
626 | for (DWORD j = 0; j < pRelatedBundle->package.cDependencyProviders; ++j) | 627 | for (DWORD j = 0; j < pRelatedBundle->package.cDependencyProviders; ++j) |
627 | { | 628 | { |
@@ -703,7 +704,8 @@ extern "C" HRESULT PlanRegistration( | |||
703 | { | 704 | { |
704 | const BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; | 705 | const BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; |
705 | 706 | ||
706 | if (BOOTSTRAPPER_RELATION_DEPENDENT == pRelatedBundle->relationType) | 707 | if (BOOTSTRAPPER_RELATION_DEPENDENT_ADDON == pRelatedBundle->planRelationType || |
708 | BOOTSTRAPPER_RELATION_DEPENDENT_PATCH == pRelatedBundle->planRelationType) | ||
707 | { | 709 | { |
708 | for (DWORD j = 0; j < pRelatedBundle->package.cDependencyProviders; ++j) | 710 | for (DWORD j = 0; j < pRelatedBundle->package.cDependencyProviders; ++j) |
709 | { | 711 | { |
@@ -1212,17 +1214,63 @@ LExit: | |||
1212 | return hr; | 1214 | return hr; |
1213 | } | 1215 | } |
1214 | 1216 | ||
1215 | extern "C" HRESULT PlanDefaultRelatedBundleRequestState( | 1217 | extern "C" HRESULT PlanDefaultRelatedBundlePlanType( |
1216 | __in BOOTSTRAPPER_RELATION_TYPE commandRelationType, | ||
1217 | __in BOOTSTRAPPER_RELATION_TYPE relatedBundleRelationType, | 1218 | __in BOOTSTRAPPER_RELATION_TYPE relatedBundleRelationType, |
1218 | __in BOOTSTRAPPER_ACTION action, | ||
1219 | __in VERUTIL_VERSION* pRegistrationVersion, | 1219 | __in VERUTIL_VERSION* pRegistrationVersion, |
1220 | __in VERUTIL_VERSION* pRelatedBundleVersion, | 1220 | __in VERUTIL_VERSION* pRelatedBundleVersion, |
1221 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestState | 1221 | __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pPlanRelationType |
1222 | ) | 1222 | ) |
1223 | { | 1223 | { |
1224 | HRESULT hr = S_OK; | 1224 | HRESULT hr = S_OK; |
1225 | int nCompareResult = 0; | 1225 | int nCompareResult = 0; |
1226 | |||
1227 | switch (relatedBundleRelationType) | ||
1228 | { | ||
1229 | case BOOTSTRAPPER_RELATION_UPGRADE: | ||
1230 | hr = VerCompareParsedVersions(pRegistrationVersion, pRelatedBundleVersion, &nCompareResult); | ||
1231 | ExitOnFailure(hr, "Failed to compare bundle version '%ls' to related bundle version '%ls'", pRegistrationVersion->sczVersion, pRelatedBundleVersion->sczVersion); | ||
1232 | |||
1233 | if (nCompareResult < 0) | ||
1234 | { | ||
1235 | *pPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE; | ||
1236 | } | ||
1237 | else | ||
1238 | { | ||
1239 | *pPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_UPGRADE; | ||
1240 | } | ||
1241 | break; | ||
1242 | case BOOTSTRAPPER_RELATION_ADDON: | ||
1243 | *pPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_ADDON; | ||
1244 | break; | ||
1245 | case BOOTSTRAPPER_RELATION_PATCH: | ||
1246 | *pPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_PATCH; | ||
1247 | break; | ||
1248 | case BOOTSTRAPPER_RELATION_DEPENDENT_ADDON: | ||
1249 | *pPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_ADDON; | ||
1250 | break; | ||
1251 | case BOOTSTRAPPER_RELATION_DEPENDENT_PATCH: | ||
1252 | *pPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_PATCH; | ||
1253 | break; | ||
1254 | case BOOTSTRAPPER_RELATION_DETECT: | ||
1255 | break; | ||
1256 | default: | ||
1257 | hr = E_UNEXPECTED; | ||
1258 | ExitOnFailure(hr, "Unexpected relation type encountered during plan: %d", relatedBundleRelationType); | ||
1259 | break; | ||
1260 | } | ||
1261 | |||
1262 | LExit: | ||
1263 | return hr; | ||
1264 | } | ||
1265 | |||
1266 | extern "C" HRESULT PlanDefaultRelatedBundleRequestState( | ||
1267 | __in BOOTSTRAPPER_RELATION_TYPE commandRelationType, | ||
1268 | __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE relatedBundleRelationType, | ||
1269 | __in BOOTSTRAPPER_ACTION action, | ||
1270 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestState | ||
1271 | ) | ||
1272 | { | ||
1273 | HRESULT hr = S_OK; | ||
1226 | BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == action || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == action; | 1274 | BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == action || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == action; |
1227 | 1275 | ||
1228 | // Never touch related bundles during Cache. | 1276 | // Never touch related bundles during Cache. |
@@ -1233,17 +1281,14 @@ extern "C" HRESULT PlanDefaultRelatedBundleRequestState( | |||
1233 | 1281 | ||
1234 | switch (relatedBundleRelationType) | 1282 | switch (relatedBundleRelationType) |
1235 | { | 1283 | { |
1236 | case BOOTSTRAPPER_RELATION_UPGRADE: | 1284 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_UPGRADE: |
1237 | if (BOOTSTRAPPER_RELATION_UPGRADE != commandRelationType && !fUninstalling) | 1285 | if (BOOTSTRAPPER_RELATION_UPGRADE != commandRelationType && !fUninstalling) |
1238 | { | 1286 | { |
1239 | hr = VerCompareParsedVersions(pRegistrationVersion, pRelatedBundleVersion, &nCompareResult); | 1287 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_ABSENT; |
1240 | ExitOnFailure(hr, "Failed to compare bundle version '%ls' to related bundle version '%ls'", pRegistrationVersion ? pRegistrationVersion->sczVersion : NULL, pRelatedBundleVersion ? pRelatedBundleVersion->sczVersion : NULL); | ||
1241 | |||
1242 | *pRequestState = (nCompareResult < 0) ? BOOTSTRAPPER_REQUEST_STATE_NONE : BOOTSTRAPPER_REQUEST_STATE_ABSENT; | ||
1243 | } | 1288 | } |
1244 | break; | 1289 | break; |
1245 | case BOOTSTRAPPER_RELATION_PATCH: __fallthrough; | 1290 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_PATCH: __fallthrough; |
1246 | case BOOTSTRAPPER_RELATION_ADDON: | 1291 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_ADDON: |
1247 | if (fUninstalling) | 1292 | if (fUninstalling) |
1248 | { | 1293 | { |
1249 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_ABSENT; | 1294 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_ABSENT; |
@@ -1257,7 +1302,8 @@ extern "C" HRESULT PlanDefaultRelatedBundleRequestState( | |||
1257 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_REPAIR; | 1302 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_REPAIR; |
1258 | } | 1303 | } |
1259 | break; | 1304 | break; |
1260 | case BOOTSTRAPPER_RELATION_DEPENDENT: | 1305 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_ADDON: __fallthrough; |
1306 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_PATCH: | ||
1261 | // Automatically repair dependent bundles to restore missing | 1307 | // Automatically repair dependent bundles to restore missing |
1262 | // packages after uninstall unless we're being upgraded with the | 1308 | // packages after uninstall unless we're being upgraded with the |
1263 | // assumption that upgrades are cumulative (as intended). | 1309 | // assumption that upgrades are cumulative (as intended). |
@@ -1266,11 +1312,12 @@ extern "C" HRESULT PlanDefaultRelatedBundleRequestState( | |||
1266 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_REPAIR; | 1312 | *pRequestState = BOOTSTRAPPER_REQUEST_STATE_REPAIR; |
1267 | } | 1313 | } |
1268 | break; | 1314 | break; |
1269 | case BOOTSTRAPPER_RELATION_DETECT: | 1315 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DOWNGRADE: __fallthrough; |
1316 | case BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE: | ||
1270 | break; | 1317 | break; |
1271 | default: | 1318 | default: |
1272 | hr = E_UNEXPECTED; | 1319 | hr = E_UNEXPECTED; |
1273 | ExitOnFailure(hr, "Unexpected relation type encountered during plan: %d", relatedBundleRelationType); | 1320 | ExitOnFailure(hr, "Unexpected plan relation type encountered during plan: %d", relatedBundleRelationType); |
1274 | break; | 1321 | break; |
1275 | } | 1322 | } |
1276 | 1323 | ||
@@ -1278,6 +1325,45 @@ LExit: | |||
1278 | return hr; | 1325 | return hr; |
1279 | } | 1326 | } |
1280 | 1327 | ||
1328 | extern "C" HRESULT PlanRelatedBundlesInitialize( | ||
1329 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
1330 | __in BURN_REGISTRATION* pRegistration, | ||
1331 | __in BOOTSTRAPPER_RELATION_TYPE /*relationType*/, | ||
1332 | __in BURN_PLAN* /*pPlan*/ | ||
1333 | ) | ||
1334 | { | ||
1335 | HRESULT hr = S_OK; | ||
1336 | |||
1337 | for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) | ||
1338 | { | ||
1339 | BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; | ||
1340 | |||
1341 | pRelatedBundle->defaultRequestedRestore = BOOTSTRAPPER_REQUEST_STATE_NONE; | ||
1342 | pRelatedBundle->requestedRestore = BOOTSTRAPPER_REQUEST_STATE_NONE; | ||
1343 | pRelatedBundle->restore = BOOTSTRAPPER_ACTION_STATE_NONE; | ||
1344 | pRelatedBundle->package.defaultRequested = BOOTSTRAPPER_REQUEST_STATE_NONE; | ||
1345 | pRelatedBundle->package.requested = BOOTSTRAPPER_REQUEST_STATE_NONE; | ||
1346 | pRelatedBundle->defaultPlanRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE; | ||
1347 | pRelatedBundle->planRelationType = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_NONE; | ||
1348 | |||
1349 | // Determine the plan relation type even if later it is ignored due to the planned action, the command relation type, or the related bundle not being plannable. | ||
1350 | // This gives more information to the BA in case it wants to override default behavior. | ||
1351 | // Doing it during plan instead of Detect allows the BA to change its mind without having to go all the way through Detect again. | ||
1352 | hr = PlanDefaultRelatedBundlePlanType(pRelatedBundle->detectRelationType, pRegistration->pVersion, pRelatedBundle->pVersion, &pRelatedBundle->defaultPlanRelationType); | ||
1353 | ExitOnFailure(hr, "Failed to get default plan type for related bundle."); | ||
1354 | |||
1355 | pRelatedBundle->planRelationType = pRelatedBundle->defaultPlanRelationType; | ||
1356 | |||
1357 | hr = UserExperienceOnPlanRelatedBundleType(pUserExperience, pRelatedBundle->package.sczId, &pRelatedBundle->planRelationType); | ||
1358 | ExitOnRootFailure(hr, "BA aborted plan related bundle type."); | ||
1359 | } | ||
1360 | |||
1361 | RelatedBundlesSortPlan(&pRegistration->relatedBundles); | ||
1362 | |||
1363 | LExit: | ||
1364 | return hr; | ||
1365 | } | ||
1366 | |||
1281 | extern "C" HRESULT PlanRelatedBundlesBegin( | 1367 | extern "C" HRESULT PlanRelatedBundlesBegin( |
1282 | __in BURN_USER_EXPERIENCE* pUserExperience, | 1368 | __in BURN_USER_EXPERIENCE* pUserExperience, |
1283 | __in BURN_REGISTRATION* pRegistration, | 1369 | __in BURN_REGISTRATION* pRegistration, |
@@ -1302,18 +1388,15 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
1302 | 1388 | ||
1303 | for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) | 1389 | for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) |
1304 | { | 1390 | { |
1305 | BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; | 1391 | BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgpPlanSortedRelatedBundles[i]; |
1306 | 1392 | ||
1307 | if (!pRelatedBundle->fPlannable) | 1393 | if (!pRelatedBundle->fPlannable) |
1308 | { | 1394 | { |
1309 | continue; | 1395 | continue; |
1310 | } | 1396 | } |
1311 | 1397 | ||
1312 | pRelatedBundle->defaultRequestedRestore = BOOTSTRAPPER_REQUEST_STATE_NONE; | 1398 | BOOL fDependent = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_ADDON == pRelatedBundle->planRelationType || |
1313 | pRelatedBundle->requestedRestore = BOOTSTRAPPER_REQUEST_STATE_NONE; | 1399 | BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_PATCH == pRelatedBundle->planRelationType; |
1314 | pRelatedBundle->restore = BOOTSTRAPPER_ACTION_STATE_NONE; | ||
1315 | pRelatedBundle->package.defaultRequested = BOOTSTRAPPER_REQUEST_STATE_NONE; | ||
1316 | pRelatedBundle->package.requested = BOOTSTRAPPER_REQUEST_STATE_NONE; | ||
1317 | 1400 | ||
1318 | // Do not execute the same bundle twice. | 1401 | // Do not execute the same bundle twice. |
1319 | if (sdAncestors) | 1402 | if (sdAncestors) |
@@ -1321,7 +1404,7 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
1321 | hr = DictKeyExists(sdAncestors, pRelatedBundle->package.sczId); | 1404 | hr = DictKeyExists(sdAncestors, pRelatedBundle->package.sczId); |
1322 | if (SUCCEEDED(hr)) | 1405 | if (SUCCEEDED(hr)) |
1323 | { | 1406 | { |
1324 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_RELATED_BUNDLE_SCHEDULED, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType)); | 1407 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_RELATED_BUNDLE_SCHEDULED, pRelatedBundle->package.sczId); |
1325 | continue; | 1408 | continue; |
1326 | } | 1409 | } |
1327 | else if (E_NOTFOUND != hr) | 1410 | else if (E_NOTFOUND != hr) |
@@ -1329,10 +1412,10 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
1329 | ExitOnFailure(hr, "Failed to lookup the bundle ID in the ancestors dictionary."); | 1412 | ExitOnFailure(hr, "Failed to lookup the bundle ID in the ancestors dictionary."); |
1330 | } | 1413 | } |
1331 | } | 1414 | } |
1332 | else if (BOOTSTRAPPER_RELATION_DEPENDENT == pRelatedBundle->relationType && BOOTSTRAPPER_RELATION_NONE != relationType) | 1415 | else if (fDependent && BOOTSTRAPPER_RELATION_NONE != relationType) |
1333 | { | 1416 | { |
1334 | // Avoid repair loops for older bundles that do not handle ancestors. | 1417 | // Avoid repair loops for older bundles that do not handle ancestors. |
1335 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_RELATED_BUNDLE_DEPENDENT, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingRelationTypeToString(relationType)); | 1418 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_RELATED_BUNDLE_DEPENDENT, pRelatedBundle->package.sczId, LoggingRelationTypeToString(relationType)); |
1336 | continue; | 1419 | continue; |
1337 | } | 1420 | } |
1338 | 1421 | ||
@@ -1340,7 +1423,7 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
1340 | pRelatedBundle->package.Bundle.wzAncestors = pRegistration->sczBundlePackageAncestors; | 1423 | pRelatedBundle->package.Bundle.wzAncestors = pRegistration->sczBundlePackageAncestors; |
1341 | pRelatedBundle->package.Bundle.wzEngineWorkingDirectory = pPlan->pInternalCommand->sczEngineWorkingDirectory; | 1424 | pRelatedBundle->package.Bundle.wzEngineWorkingDirectory = pPlan->pInternalCommand->sczEngineWorkingDirectory; |
1342 | 1425 | ||
1343 | hr = PlanDefaultRelatedBundleRequestState(relationType, pRelatedBundle->relationType, pPlan->action, pRegistration->pVersion, pRelatedBundle->pVersion, &pRelatedBundle->package.requested); | 1426 | hr = PlanDefaultRelatedBundleRequestState(relationType, pRelatedBundle->planRelationType, pPlan->action, &pRelatedBundle->package.requested); |
1344 | ExitOnFailure(hr, "Failed to get default request state for related bundle."); | 1427 | ExitOnFailure(hr, "Failed to get default request state for related bundle."); |
1345 | 1428 | ||
1346 | pRelatedBundle->package.defaultRequested = pRelatedBundle->package.requested; | 1429 | pRelatedBundle->package.defaultRequested = pRelatedBundle->package.requested; |
@@ -1349,7 +1432,7 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
1349 | ExitOnRootFailure(hr, "BA aborted plan related bundle."); | 1432 | ExitOnRootFailure(hr, "BA aborted plan related bundle."); |
1350 | 1433 | ||
1351 | // If uninstalling and the dependent related bundle may be executed, ignore its provider key to allow for downgrades with ref-counting. | 1434 | // If uninstalling and the dependent related bundle may be executed, ignore its provider key to allow for downgrades with ref-counting. |
1352 | if (fUninstalling && BOOTSTRAPPER_RELATION_DEPENDENT == pRelatedBundle->relationType && BOOTSTRAPPER_REQUEST_STATE_NONE != pRelatedBundle->package.requested) | 1435 | if (fUninstalling && fDependent && BOOTSTRAPPER_REQUEST_STATE_NONE != pRelatedBundle->package.requested) |
1353 | { | 1436 | { |
1354 | if (0 < pRelatedBundle->package.cDependencyProviders) | 1437 | if (0 < pRelatedBundle->package.cDependencyProviders) |
1355 | { | 1438 | { |
@@ -1437,7 +1520,11 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1437 | for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) | 1520 | for (DWORD i = 0; i < pRegistration->relatedBundles.cRelatedBundles; ++i) |
1438 | { | 1521 | { |
1439 | DWORD *pdwInsertIndex = NULL; | 1522 | DWORD *pdwInsertIndex = NULL; |
1440 | BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + i; | 1523 | BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgpPlanSortedRelatedBundles[i]; |
1524 | BOOL fDependent = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_ADDON == pRelatedBundle->planRelationType || | ||
1525 | BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_DEPENDENT_PATCH == pRelatedBundle->planRelationType; | ||
1526 | BOOL fAddonOrPatch = BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_ADDON == pRelatedBundle->planRelationType || | ||
1527 | BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_PATCH == pRelatedBundle->planRelationType; | ||
1441 | 1528 | ||
1442 | if (!pRelatedBundle->fPlannable) | 1529 | if (!pRelatedBundle->fPlannable) |
1443 | { | 1530 | { |
@@ -1454,7 +1541,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1454 | { | 1541 | { |
1455 | ExitOnFailure(hr, "Failed to check the dictionary for a related bundle provider key: \"%ls\".", pProvider->sczKey); | 1542 | ExitOnFailure(hr, "Failed to check the dictionary for a related bundle provider key: \"%ls\".", pProvider->sczKey); |
1456 | // Key found, so there is an embedded bundle with the same provider key that will be executed. So this related bundle should not be added to the plan | 1543 | // Key found, so there is an embedded bundle with the same provider key that will be executed. So this related bundle should not be added to the plan |
1457 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_RELATED_BUNDLE_EMBEDDED_BUNDLE_NEWER, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), pProvider->sczKey); | 1544 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_RELATED_BUNDLE_EMBEDDED_BUNDLE_NEWER, pRelatedBundle->package.sczId, pProvider->sczKey); |
1458 | continue; | 1545 | continue; |
1459 | } | 1546 | } |
1460 | else | 1547 | else |
@@ -1464,13 +1551,13 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1464 | } | 1551 | } |
1465 | 1552 | ||
1466 | // For an uninstall, there is no need to repair dependent bundles if no packages are executing. | 1553 | // For an uninstall, there is no need to repair dependent bundles if no packages are executing. |
1467 | if (!fExecutingAnyPackage && BOOTSTRAPPER_RELATION_DEPENDENT == pRelatedBundle->relationType && BOOTSTRAPPER_REQUEST_STATE_REPAIR == pRelatedBundle->package.requested && fUninstalling) | 1554 | if (!fExecutingAnyPackage && fDependent && BOOTSTRAPPER_REQUEST_STATE_REPAIR == pRelatedBundle->package.requested && fUninstalling) |
1468 | { | 1555 | { |
1469 | pRelatedBundle->package.requested = BOOTSTRAPPER_REQUEST_STATE_NONE; | 1556 | pRelatedBundle->package.requested = BOOTSTRAPPER_REQUEST_STATE_NONE; |
1470 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_DEPENDENT_BUNDLE_REPAIR, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType)); | 1557 | LogId(REPORT_STANDARD, MSG_PLAN_SKIPPED_DEPENDENT_BUNDLE_REPAIR, pRelatedBundle->package.sczId); |
1471 | } | 1558 | } |
1472 | 1559 | ||
1473 | if (BOOTSTRAPPER_RELATION_ADDON == pRelatedBundle->relationType || BOOTSTRAPPER_RELATION_PATCH == pRelatedBundle->relationType) | 1560 | if (fAddonOrPatch) |
1474 | { | 1561 | { |
1475 | // Addon and patch bundles will be passed a list of dependencies to ignore for planning. | 1562 | // Addon and patch bundles will be passed a list of dependencies to ignore for planning. |
1476 | hr = StrAllocString(&pRelatedBundle->package.Bundle.sczIgnoreDependencies, sczIgnoreDependencies, 0); | 1563 | hr = StrAllocString(&pRelatedBundle->package.Bundle.sczIgnoreDependencies, sczIgnoreDependencies, 0); |
@@ -1489,7 +1576,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1489 | ExitOnFailure(hr, "Failed to calculate plan for related bundle: %ls", pRelatedBundle->package.sczId); | 1576 | ExitOnFailure(hr, "Failed to calculate plan for related bundle: %ls", pRelatedBundle->package.sczId); |
1490 | 1577 | ||
1491 | // Calculate package states based on reference count for addon and patch related bundles. | 1578 | // Calculate package states based on reference count for addon and patch related bundles. |
1492 | if (BOOTSTRAPPER_RELATION_ADDON == pRelatedBundle->relationType || BOOTSTRAPPER_RELATION_PATCH == pRelatedBundle->relationType) | 1579 | if (fAddonOrPatch) |
1493 | { | 1580 | { |
1494 | hr = DependencyPlanPackageBegin(pRegistration->fPerMachine, &pRelatedBundle->package, pPlan); | 1581 | hr = DependencyPlanPackageBegin(pRegistration->fPerMachine, &pRelatedBundle->package, pPlan); |
1495 | ExitOnFailure(hr, "Failed to begin plan dependency actions to package: %ls", pRelatedBundle->package.sczId); | 1582 | ExitOnFailure(hr, "Failed to begin plan dependency actions to package: %ls", pRelatedBundle->package.sczId); |
@@ -1505,7 +1592,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1505 | ExitOnFailure(hr, "Failed to add to plan related bundle: %ls", pRelatedBundle->package.sczId); | 1592 | ExitOnFailure(hr, "Failed to add to plan related bundle: %ls", pRelatedBundle->package.sczId); |
1506 | 1593 | ||
1507 | // Calculate package states based on reference count for addon and patch related bundles. | 1594 | // Calculate package states based on reference count for addon and patch related bundles. |
1508 | if (BOOTSTRAPPER_RELATION_ADDON == pRelatedBundle->relationType || BOOTSTRAPPER_RELATION_PATCH == pRelatedBundle->relationType) | 1595 | if (fAddonOrPatch) |
1509 | { | 1596 | { |
1510 | hr = DependencyPlanPackageComplete(&pRelatedBundle->package, pPlan); | 1597 | hr = DependencyPlanPackageComplete(&pRelatedBundle->package, pPlan); |
1511 | ExitOnFailure(hr, "Failed to complete plan dependency actions for related bundle package: %ls", pRelatedBundle->package.sczId); | 1598 | ExitOnFailure(hr, "Failed to complete plan dependency actions for related bundle package: %ls", pRelatedBundle->package.sczId); |
@@ -1517,7 +1604,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1517 | PlannedExecutePackage(pPlan, &pRelatedBundle->package); | 1604 | PlannedExecutePackage(pPlan, &pRelatedBundle->package); |
1518 | } | 1605 | } |
1519 | } | 1606 | } |
1520 | else if (BOOTSTRAPPER_RELATION_ADDON == pRelatedBundle->relationType || BOOTSTRAPPER_RELATION_PATCH == pRelatedBundle->relationType) | 1607 | else if (fAddonOrPatch) |
1521 | { | 1608 | { |
1522 | // Make sure the package is properly ref-counted even if no plan is requested. | 1609 | // Make sure the package is properly ref-counted even if no plan is requested. |
1523 | hr = DependencyPlanPackageBegin(pRegistration->fPerMachine, &pRelatedBundle->package, pPlan); | 1610 | hr = DependencyPlanPackageBegin(pRegistration->fPerMachine, &pRelatedBundle->package, pPlan); |
@@ -1530,7 +1617,7 @@ extern "C" HRESULT PlanRelatedBundlesComplete( | |||
1530 | ExitOnFailure(hr, "Failed to complete plan dependency actions for related bundle package: %ls", pRelatedBundle->package.sczId); | 1617 | ExitOnFailure(hr, "Failed to complete plan dependency actions for related bundle package: %ls", pRelatedBundle->package.sczId); |
1531 | } | 1618 | } |
1532 | 1619 | ||
1533 | if (fInstallingAnyPackage && BOOTSTRAPPER_RELATION_UPGRADE == pRelatedBundle->relationType) | 1620 | if (fInstallingAnyPackage && BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE_UPGRADE == pRelatedBundle->planRelationType) |
1534 | { | 1621 | { |
1535 | BURN_EXECUTE_ACTION* pAction = NULL; | 1622 | BURN_EXECUTE_ACTION* pAction = NULL; |
1536 | 1623 | ||