diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-04-16 10:56:24 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-04-19 23:12:55 -0500 |
commit | c308746132f3ab89458b446f659f3d4073758da6 (patch) | |
tree | f1b480ebdf491dde211c578ac03efc18e6ded374 | |
parent | 70bb69c0e5f589fb55d3e36a5e81e9a7d0e56814 (diff) | |
download | wix-c308746132f3ab89458b446f659f3d4073758da6.tar.gz wix-c308746132f3ab89458b446f659f3d4073758da6.tar.bz2 wix-c308746132f3ab89458b446f659f3d4073758da6.zip |
When extracting a container use the uncompressed file size for progress
Remove the container's cache progress when reextracting
Skip extracting payloads that are already cached
-rw-r--r-- | src/engine/apply.cpp | 17 | ||||
-rw-r--r-- | src/engine/container.h | 2 | ||||
-rw-r--r-- | src/engine/plan.cpp | 16 | ||||
-rw-r--r-- | src/test/BurnUnitTest/PlanTest.cpp | 8 |
4 files changed, 33 insertions, 10 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp index 5402e55c..f80baf26 100644 --- a/src/engine/apply.cpp +++ b/src/engine/apply.cpp | |||
@@ -869,6 +869,12 @@ static HRESULT ApplyExtractContainer( | |||
869 | { | 869 | { |
870 | HRESULT hr = S_OK; | 870 | HRESULT hr = S_OK; |
871 | 871 | ||
872 | if (pContainer->qwCommittedCacheProgress) | ||
873 | { | ||
874 | pContext->qwSuccessfulCacheProgress -= pContainer->qwCommittedCacheProgress; | ||
875 | pContainer->qwCommittedCacheProgress = 0; | ||
876 | } | ||
877 | |||
872 | if (!pContainer->fActuallyAttached) | 878 | if (!pContainer->fActuallyAttached) |
873 | { | 879 | { |
874 | hr = ApplyAcquireContainerOrPayload(pContext, pContainer, NULL, NULL); | 880 | hr = ApplyAcquireContainerOrPayload(pContext, pContainer, NULL, NULL); |
@@ -884,7 +890,8 @@ static HRESULT ApplyExtractContainer( | |||
884 | CacheSetLastUsedSource(pContext->pVariables, pContext->sczLastUsedFolderCandidate, pContainer->sczFilePath); | 890 | CacheSetLastUsedSource(pContext->pVariables, pContext->sczLastUsedFolderCandidate, pContainer->sczFilePath); |
885 | } | 891 | } |
886 | 892 | ||
887 | pContext->qwSuccessfulCacheProgress += pContainer->qwFileSize; | 893 | pContext->qwSuccessfulCacheProgress += pContainer->qwExtractSizeTotal; |
894 | pContainer->qwCommittedCacheProgress += pContainer->qwExtractSizeTotal; | ||
888 | 895 | ||
889 | LExit: | 896 | LExit: |
890 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); | 897 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); |
@@ -1110,7 +1117,7 @@ static HRESULT ExtractContainer( | |||
1110 | for (DWORD iExtract = 0; iExtract < pContext->pPayloads->cPayloads; ++iExtract) | 1117 | for (DWORD iExtract = 0; iExtract < pContext->pPayloads->cPayloads; ++iExtract) |
1111 | { | 1118 | { |
1112 | BURN_PAYLOAD* pExtract = pContext->pPayloads->rgPayloads + iExtract; | 1119 | BURN_PAYLOAD* pExtract = pContext->pPayloads->rgPayloads + iExtract; |
1113 | if (pExtract->sczUnverifiedPath && CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczExtractPayloadId, -1, pExtract->sczSourcePath, -1)) | 1120 | if (pExtract->sczUnverifiedPath && pExtract->cRemainingInstances && CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczExtractPayloadId, -1, pExtract->sczSourcePath, -1)) |
1114 | { | 1121 | { |
1115 | hr = PreparePayloadDestinationPath(pExtract->sczUnverifiedPath); | 1122 | hr = PreparePayloadDestinationPath(pExtract->sczUnverifiedPath); |
1116 | ExitOnFailure(hr, "Failed to prepare payload destination path: %ls", pExtract->sczUnverifiedPath); | 1123 | ExitOnFailure(hr, "Failed to prepare payload destination path: %ls", pExtract->sczUnverifiedPath); |
@@ -1747,7 +1754,11 @@ static HRESULT CompleteCacheProgress( | |||
1747 | if (PROGRESS_CONTINUE == dwResult) | 1754 | if (PROGRESS_CONTINUE == dwResult) |
1748 | { | 1755 | { |
1749 | pContext->pCacheContext->qwSuccessfulCacheProgress += qwFileSize; | 1756 | pContext->pCacheContext->qwSuccessfulCacheProgress += qwFileSize; |
1750 | if (pContext->pPayloadGroupItem) | 1757 | if (pContext->pContainer) |
1758 | { | ||
1759 | pContext->pContainer->qwCommittedCacheProgress += qwFileSize; | ||
1760 | } | ||
1761 | else if (pContext->pPayloadGroupItem) | ||
1751 | { | 1762 | { |
1752 | pContext->pPayloadGroupItem->qwCommittedCacheProgress += qwFileSize; | 1763 | pContext->pPayloadGroupItem->qwCommittedCacheProgress += qwFileSize; |
1753 | } | 1764 | } |
diff --git a/src/engine/container.h b/src/engine/container.h index d38016cc..7c5c2b5f 100644 --- a/src/engine/container.h +++ b/src/engine/container.h | |||
@@ -76,6 +76,8 @@ typedef struct _BURN_CONTAINER | |||
76 | BOOL fPlanned; | 76 | BOOL fPlanned; |
77 | LPWSTR sczSourcePath; | 77 | LPWSTR sczSourcePath; |
78 | LPWSTR sczUnverifiedPath; | 78 | LPWSTR sczUnverifiedPath; |
79 | DWORD64 qwExtractSizeTotal; | ||
80 | DWORD64 qwCommittedCacheProgress; | ||
79 | } BURN_CONTAINER; | 81 | } BURN_CONTAINER; |
80 | 82 | ||
81 | typedef struct _BURN_CONTAINERS | 83 | typedef struct _BURN_CONTAINERS |
diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index 55fe7ddf..8421d87b 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp | |||
@@ -431,6 +431,7 @@ extern "C" HRESULT PlanLayoutBundle( | |||
431 | pCacheAction->bundleLayout.qwBundleSize = qwBundleSize; | 431 | pCacheAction->bundleLayout.qwBundleSize = qwBundleSize; |
432 | pCacheAction->bundleLayout.pPayloadGroup = pLayoutPayloads; | 432 | pCacheAction->bundleLayout.pPayloadGroup = pLayoutPayloads; |
433 | 433 | ||
434 | // Acquire + Verify | ||
434 | pPlan->qwCacheSizeTotal += 2 * qwBundleSize; | 435 | pPlan->qwCacheSizeTotal += 2 * qwBundleSize; |
435 | 436 | ||
436 | ++pPlan->cOverallProgressTicksTotal; | 437 | ++pPlan->cOverallProgressTicksTotal; |
@@ -1005,6 +1006,7 @@ extern "C" HRESULT PlanLayoutContainer( | |||
1005 | pCacheAction->type = BURN_CACHE_ACTION_TYPE_CONTAINER; | 1006 | pCacheAction->type = BURN_CACHE_ACTION_TYPE_CONTAINER; |
1006 | pCacheAction->container.pContainer = pContainer; | 1007 | pCacheAction->container.pContainer = pContainer; |
1007 | 1008 | ||
1009 | // Acquire + Verify | ||
1008 | pPlan->qwCacheSizeTotal += 2 * pContainer->qwFileSize; | 1010 | pPlan->qwCacheSizeTotal += 2 * pContainer->qwFileSize; |
1009 | } | 1011 | } |
1010 | } | 1012 | } |
@@ -1012,11 +1014,9 @@ extern "C" HRESULT PlanLayoutContainer( | |||
1012 | { | 1014 | { |
1013 | if (!pContainer->fActuallyAttached) | 1015 | if (!pContainer->fActuallyAttached) |
1014 | { | 1016 | { |
1017 | // Acquire | ||
1015 | pPlan->qwCacheSizeTotal += pContainer->qwFileSize; | 1018 | pPlan->qwCacheSizeTotal += pContainer->qwFileSize; |
1016 | } | 1019 | } |
1017 | |||
1018 | // TODO: This should be the sum of all uncompressed payloads in the container, ideally restricted to the payloads that were actually planned. | ||
1019 | pPlan->qwCacheSizeTotal += pContainer->qwFileSize; | ||
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | if (!pContainer->sczUnverifiedPath) | 1022 | if (!pContainer->sczUnverifiedPath) |
@@ -1829,6 +1829,8 @@ static void ResetPlannedContainerState( | |||
1829 | ) | 1829 | ) |
1830 | { | 1830 | { |
1831 | pContainer->fPlanned = FALSE; | 1831 | pContainer->fPlanned = FALSE; |
1832 | pContainer->qwExtractSizeTotal = 0; | ||
1833 | pContainer->qwCommittedCacheProgress = 0; | ||
1832 | } | 1834 | } |
1833 | 1835 | ||
1834 | static void ResetPlannedPayloadsState( | 1836 | static void ResetPlannedPayloadsState( |
@@ -2246,9 +2248,17 @@ static HRESULT ProcessPayloadGroup( | |||
2246 | 2248 | ||
2247 | if (!pPlan->sczLayoutDirectory || !pPayload->pContainer) | 2249 | if (!pPlan->sczLayoutDirectory || !pPayload->pContainer) |
2248 | { | 2250 | { |
2251 | // Acquire + Verify | ||
2249 | pPlan->qwCacheSizeTotal += 2 * pPayload->qwFileSize; | 2252 | pPlan->qwCacheSizeTotal += 2 * pPayload->qwFileSize; |
2250 | } | 2253 | } |
2251 | 2254 | ||
2255 | if (!pPlan->sczLayoutDirectory && pPayload->pContainer && 1 == pPayload->cRemainingInstances) | ||
2256 | { | ||
2257 | // Extract | ||
2258 | pPlan->qwCacheSizeTotal += pPayload->qwFileSize; | ||
2259 | pPayload->pContainer->qwExtractSizeTotal += pPayload->qwFileSize; | ||
2260 | } | ||
2261 | |||
2252 | if (!pPayload->sczUnverifiedPath) | 2262 | if (!pPayload->sczUnverifiedPath) |
2253 | { | 2263 | { |
2254 | hr = CacheCalculatePayloadWorkingPath(pPlan->wzBundleId, pPayload, &pPayload->sczUnverifiedPath); | 2264 | hr = CacheCalculatePayloadWorkingPath(pPlan->wzBundleId, pPayload, &pPayload->sczUnverifiedPath); |
diff --git a/src/test/BurnUnitTest/PlanTest.cpp b/src/test/BurnUnitTest/PlanTest.cpp index aa9deaf6..c073696b 100644 --- a/src/test/BurnUnitTest/PlanTest.cpp +++ b/src/test/BurnUnitTest/PlanTest.cpp | |||
@@ -71,7 +71,7 @@ namespace Bootstrapper | |||
71 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); | 71 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); |
72 | 72 | ||
73 | Assert::Equal(107082ull, pPlan->qwEstimatedSize); | 73 | Assert::Equal(107082ull, pPlan->qwEstimatedSize); |
74 | Assert::Equal(202458ull, pPlan->qwCacheSizeTotal); | 74 | Assert::Equal(303687ull, pPlan->qwCacheSizeTotal); |
75 | 75 | ||
76 | fRollback = FALSE; | 76 | fRollback = FALSE; |
77 | dwIndex = 0; | 77 | dwIndex = 0; |
@@ -308,7 +308,7 @@ namespace Bootstrapper | |||
308 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); | 308 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); |
309 | 309 | ||
310 | Assert::Equal(35694ull, pPlan->qwEstimatedSize); | 310 | Assert::Equal(35694ull, pPlan->qwEstimatedSize); |
311 | Assert::Equal(67486ull, pPlan->qwCacheSizeTotal); | 311 | Assert::Equal(101229ull, pPlan->qwCacheSizeTotal); |
312 | 312 | ||
313 | fRollback = FALSE; | 313 | fRollback = FALSE; |
314 | dwIndex = 0; | 314 | dwIndex = 0; |
@@ -388,7 +388,7 @@ namespace Bootstrapper | |||
388 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); | 388 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); |
389 | 389 | ||
390 | Assert::Equal(33743ull, pPlan->qwEstimatedSize); | 390 | Assert::Equal(33743ull, pPlan->qwEstimatedSize); |
391 | Assert::Equal(67486ull, pPlan->qwCacheSizeTotal); | 391 | Assert::Equal(101229ull, pPlan->qwCacheSizeTotal); |
392 | 392 | ||
393 | fRollback = FALSE; | 393 | fRollback = FALSE; |
394 | dwIndex = 0; | 394 | dwIndex = 0; |
@@ -458,7 +458,7 @@ namespace Bootstrapper | |||
458 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); | 458 | Assert::Equal(dwIndex, pPlan->cRollbackCacheActions); |
459 | 459 | ||
460 | Assert::Equal(35694ull, pPlan->qwEstimatedSize); | 460 | Assert::Equal(35694ull, pPlan->qwEstimatedSize); |
461 | Assert::Equal(67486ull, pPlan->qwCacheSizeTotal); | 461 | Assert::Equal(101229ull, pPlan->qwCacheSizeTotal); |
462 | 462 | ||
463 | fRollback = FALSE; | 463 | fRollback = FALSE; |
464 | dwIndex = 0; | 464 | dwIndex = 0; |