|
17 | 17 | from invoke.exceptions import Exit, UnexpectedExit |
18 | 18 |
|
19 | 19 | from tasks.libs.ciproviders.gitlab_api import get_gitlab_repo |
20 | | -from tasks.libs.common.utils import download_to_tempfile, timed |
| 20 | +from tasks.libs.common.utils import download_to_tempfile, running_in_ci, timed |
21 | 21 | from tasks.libs.dependencies import get_effective_dependencies_env |
22 | 22 | from tasks.libs.releasing.version import VERSION_RE, _create_version_from_match, get_version |
23 | 23 |
|
@@ -135,6 +135,11 @@ def _ensure_wix_tools(ctx): |
135 | 135 | # Note: .NET global tools are invoked directly by name, not with 'dotnet' prefix |
136 | 136 | result = ctx.run('wix --version', warn=True, hide=True) |
137 | 137 | if not result or result.return_code != 0: |
| 138 | + if running_in_ci(): |
| 139 | + raise Exit( |
| 140 | + "WiX tools not found in CI.", |
| 141 | + code=1, |
| 142 | + ) |
138 | 143 | # Install WiX 5.x globally |
139 | 144 | print(f"WiX tools not found. Installing WiX {WIX_VERSION} globally...") |
140 | 145 | result = ctx.run(f'dotnet tool install --global wix --version {WIX_VERSION}', warn=True) |
@@ -177,11 +182,14 @@ def _ensure_wix_extensions(ctx, extensions, version): |
177 | 182 | print(f"WiX extension {expected} already installed") |
178 | 183 | continue |
179 | 184 | else: |
| 185 | + if running_in_ci(): |
| 186 | + raise Exit( |
| 187 | + f"WiX extension {ext} has wrong version {installed_extensions[ext]} in CI, need {version}.", |
| 188 | + code=1, |
| 189 | + ) |
180 | 190 | # Wrong version installed - remove it first |
181 | 191 | print(f"Removing incompatible WiX extension {ext}/{installed_extensions[ext]}...") |
182 | 192 | ctx.run(f'wix extension remove -g {ext}', warn=True, hide=True) |
183 | | - |
184 | | - # Install the extension with the correct version |
185 | 193 | print(f"Installing WiX extension {expected}...") |
186 | 194 | result = ctx.run(f'wix extension add -g {expected}', warn=True) |
187 | 195 | if not result or result.return_code != 0: |
@@ -278,6 +286,7 @@ def _build_wxs(ctx, env, outdir, ca_dll): |
278 | 286 | raise Exit("Failed to build the MSI WXS.", code=1) |
279 | 287 |
|
280 | 288 | # sign the MakeSfxCA output files |
| 289 | + # If signing fails due to corrupted PE file / signature, it may be a regression caused by the makesfxca template DLL being previously signed before the embedded files were added to it. For more information refer to `_fix_makesfxca_dll` from `msi.py` in the git history. |
281 | 290 | sign_file(ctx, os.path.join(outdir, ca_dll)) |
282 | 291 |
|
283 | 292 |
|
@@ -551,7 +560,9 @@ def validate_msi_createfolder_table(db, allowlist): |
551 | 560 |
|
552 | 561 |
|
553 | 562 | @task |
554 | | -def validate_msi(_, allowlist, msi=None): |
| 563 | +def validate_msi(ctx, allowlist, msi=None): |
| 564 | + print(f"Validating MSI") |
| 565 | + ctx.run(f'wix msi validate "{msi}"') |
555 | 566 | with MsiClosing(msilib.OpenDatabase(msi, msilib.MSIDBOPEN_READONLY)) as db: |
556 | 567 | validate_msi_createfolder_table(db, allowlist) |
557 | 568 |
|
|
0 commit comments