提交记录修改packaging/windows/installation-files.ps1+2 −1看文件
修改scripts/ci-windows-build.ps1+3 −1看文件
修改scripts/test-windows-installation-files.ps1+14 −3看文件
| @@ -150,7 +150,8 @@ function Complete-Transfer { | ||
| 150 | 150 | $relative = if ($entry.state -eq 'moved') { $entry.destination } else { $entry.path } |
| 151 | 151 | if (!(Get-Item -LiteralPath (Join-Path $Target $relative) -Force -ErrorAction SilentlyContinue)) { throw ('个人文件尚未恢复,事务回执已保留:' + $relative) } |
| 152 | 152 | } |
| 153 | 删除: $hash = (Get-FileHash -LiteralPath $Receipt -Algorithm SHA256).Hash | |
| 153 | 新增: $receiptStream = Open-ReadLocked $Receipt | |
| 154 | 新增: try { $hash = Stream-Hash $receiptStream } finally { $receiptStream.Dispose() } | |
| 154 | 155 | Remove-MatchingFile (Split-Path $Receipt -Parent) (Split-Path $Receipt -Leaf) $hash |
| 155 | 156 | if (Test-Path -LiteralPath $Receipt) { throw '安装回执在完成期间发生变化,已保留待核对。' } |
| 156 | 157 | } |
| @@ -53,7 +53,9 @@ try { | ||
| 53 | 53 | Invoke-BuildTool 'node' @('--test', 'internal/cage/browser-clipboard.test.mjs', 'scripts/windows-native-bridge.test.mjs') |
| 54 | 54 | Invoke-BuildTool (Get-BuildCommand @('pwsh.exe', 'pwsh')) @('-NoProfile', '-NonInteractive', '-File', 'scripts/windows-workbench-smoke.test.ps1') |
| 55 | 55 | $windowsPowerShell = Join-Path ([Environment]::SystemDirectory) 'WindowsPowerShell/v1.0/powershell.exe' |
| 56 | 删除: & (Join-Path $PSScriptRoot 'test-windows-installation-files.ps1') -HelperShell $windowsPowerShell -InstallerSmoke | |
| 56 | 新增: # NSIS is x86 and resolves $SYSDIR to SysWOW64. Match its real helper host. | |
| 57 | 新增: $installationPowerShell = Join-Path $env:SystemRoot 'SysWOW64/WindowsPowerShell/v1.0/powershell.exe' | |
| 58 | 新增: & (Join-Path $PSScriptRoot 'test-windows-installation-files.ps1') -HelperShell $installationPowerShell -InstallerSmoke | |
| 57 | 59 | if ($Release) { |
| 58 | 60 | & (Join-Path $PSScriptRoot 'prepare-qemu-release.ps1') |
| 59 | 61 | $qemuSource = Join-Path $repository '_output/windows-qemu-sources/full-source.tar.gz' |
| @@ -44,10 +44,21 @@ function App([string]$Path, [string]$Version) { | ||
| 44 | 44 | }) |
| 45 | 45 | @{version = 1; files = $files} | ConvertTo-Json -Depth 4 | Set-Content (Join-Path $Path 'Cage.install-files.json') |
| 46 | 46 | } |
| 47 | 删除:function Invoke-Helper([string[]]$Arguments, [int]$Expected = 0) { | |
| 47 | 新增:function Invoke-Helper([string[]]$Arguments, [int]$Expected = 0, [switch]$WithoutFileHash) { | |
| 48 | 新增: $entry = $helper | |
| 49 | 新增: if ($WithoutFileHash) { | |
| 50 | 新增: $entry = Join-Path $root 'helper-without-filehash.ps1' | |
| 51 | 新增: Write-File $entry @' | |
| 52 | 新增:$ErrorActionPreference = 'Stop' | |
| 53 | 新增:function global:Get-FileHash { throw [Management.Automation.CommandNotFoundException]::new('Get-FileHash is intentionally unavailable in this native helper fixture.') } | |
| 54 | 新增:$remaining = @($args | Select-Object -Skip 1) | |
| 55 | 新增:& $args[0] @remaining | |
| 56 | 新增:'@ | |
| 57 | 新增: $Arguments = @($helper) + $Arguments | |
| 58 | 新增: } | |
| 48 | 59 | try { |
| 49 | 60 | $ErrorActionPreference = 'Continue' |
| 50 | 删除: $output = & $HelperShell -NoProfile -File $helper @Arguments 2>&1 | Out-String | |
| 61 | 新增: $output = & $HelperShell -NoProfile -File $entry @Arguments 2>&1 | Out-String | |
| 51 | 62 | } finally { $ErrorActionPreference = 'Stop' } |
| 52 | 63 | if ($LASTEXITCODE -ne $Expected) { throw "Helper returned $LASTEXITCODE, expected $Expected. $output" } |
| 53 | 64 | } |
| @@ -126,7 +137,7 @@ try { | ||
| 126 | 137 | $transfer = Get-Content -LiteralPath $receipt -Raw | ConvertFrom-Json |
| 127 | 138 | Check (!$transfer.backupPath -and @($transfer.moves).Count -eq 0) 'First install invented a backup or personal file transfer.' |
| 128 | 139 | [IO.Directory]::Delete($old); [IO.Directory]::Move($stage, $old) |
| 129 | 删除: Invoke-Helper @('-Operation','complete','-Target',$old,'-Receipt',$receipt) | |
| 140 | 新增: Invoke-Helper @('-Operation','complete','-Target',$old,'-Receipt',$receipt) -WithoutFileHash | |
| 130 | 141 | Check (!(Test-Path -LiteralPath $receipt)) 'First install did not finish its transaction.' |
| 131 | 142 | |
| 132 | 143 | $diagnostic = Join-Path $scenario 'diagnostic.json' |

