Apply pending Windows binary replacements
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
This commit is contained in:
+25
@@ -353,6 +353,30 @@ exit 1
|
|||||||
Start-Process -FilePath $ps -ArgumentList @("-NoProfile", "-EncodedCommand", $encoded) -WindowStyle Hidden | Out-Null
|
Start-Process -FilePath $ps -ArgumentList @("-NoProfile", "-EncodedCommand", $encoded) -WindowStyle Hidden | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Apply-PendingBinaryReplacements($Dir) {
|
||||||
|
if (-not (Test-Path -LiteralPath $Dir)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Get-ChildItem -LiteralPath $Dir -File -Filter "*.pending.*" | ForEach-Object {
|
||||||
|
$pending = $_.FullName
|
||||||
|
$name = $_.Name
|
||||||
|
$marker = ".pending."
|
||||||
|
$index = $name.LastIndexOf($marker)
|
||||||
|
if ($index -lt 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$destinationName = $name.Substring(0, $index)
|
||||||
|
$destination = Join-Path $Dir $destinationName
|
||||||
|
try {
|
||||||
|
Move-Item -LiteralPath $pending -Destination $destination -Force
|
||||||
|
Write-Info "Applied pending Dosh binary replacement: $destination"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Warning "pending Dosh binary replacement still waiting: $destination"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Normalize-PathForCompare($Path) {
|
function Normalize-PathForCompare($Path) {
|
||||||
[System.IO.Path]::GetFullPath($Path).TrimEnd(
|
[System.IO.Path]::GetFullPath($Path).TrimEnd(
|
||||||
[System.IO.Path]::DirectorySeparatorChar,
|
[System.IO.Path]::DirectorySeparatorChar,
|
||||||
@@ -437,6 +461,7 @@ function Write-Utf8NoBom($Path, $Content) {
|
|||||||
$bindir = Join-Path $Prefix "bin"
|
$bindir = Join-Path $Prefix "bin"
|
||||||
$configDir = Join-Path $HOME ".config\dosh"
|
$configDir = Join-Path $HOME ".config\dosh"
|
||||||
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
|
||||||
|
Apply-PendingBinaryReplacements $bindir
|
||||||
|
|
||||||
function Install-Prebuilt {
|
function Install-Prebuilt {
|
||||||
if (Latest-ReleaseIsStale) {
|
if (Latest-ReleaseIsStale) {
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ fn windows_prebuilt_install_requires_client_but_not_bench() {
|
|||||||
fn windows_installer_stages_locked_binary_replacements() {
|
fn windows_installer_stages_locked_binary_replacements() {
|
||||||
let ps1 = include_str!("../install.ps1");
|
let ps1 = include_str!("../install.ps1");
|
||||||
assert!(ps1.contains("function Start-DeferredBinaryReplacement"));
|
assert!(ps1.contains("function Start-DeferredBinaryReplacement"));
|
||||||
|
assert!(ps1.contains("function Apply-PendingBinaryReplacements"));
|
||||||
assert!(ps1.contains("$pending = \"$Destination.pending.$PID\""));
|
assert!(ps1.contains("$pending = \"$Destination.pending.$PID\""));
|
||||||
assert!(ps1.contains("Move-Item -LiteralPath $tmp -Destination $pending -Force"));
|
assert!(ps1.contains("Move-Item -LiteralPath $tmp -Destination $pending -Force"));
|
||||||
assert!(ps1.contains("Start-DeferredBinaryReplacement $pending $Destination"));
|
assert!(ps1.contains("Start-DeferredBinaryReplacement $pending $Destination"));
|
||||||
@@ -335,6 +336,17 @@ fn windows_installer_stages_locked_binary_replacements() {
|
|||||||
));
|
));
|
||||||
assert!(ps1.contains("[System.Text.Encoding]::Unicode.GetBytes($script)"));
|
assert!(ps1.contains("[System.Text.Encoding]::Unicode.GetBytes($script)"));
|
||||||
assert!(ps1.contains("Start-Process -FilePath $ps"));
|
assert!(ps1.contains("Start-Process -FilePath $ps"));
|
||||||
|
assert!(ps1.contains("Get-ChildItem -LiteralPath $Dir -File -Filter \"*.pending.*\""));
|
||||||
|
assert!(ps1.contains("$marker = \".pending.\""));
|
||||||
|
assert!(ps1.contains("$destinationName = $name.Substring(0, $index)"));
|
||||||
|
assert!(ps1.contains("Move-Item -LiteralPath $pending -Destination $destination -Force"));
|
||||||
|
assert!(ps1.contains("Apply-PendingBinaryReplacements $bindir"));
|
||||||
|
let recovery = ps1.find("Apply-PendingBinaryReplacements $bindir").unwrap();
|
||||||
|
let install = ps1.find("if ($UsePrebuilt)").unwrap();
|
||||||
|
assert!(
|
||||||
|
recovery < install,
|
||||||
|
"pending binary replacements must be recovered before installing new binaries"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user