ouroboros/scripts/download_ripgrep_standalone.ps1
Anton Razzhigaev c9c578f03d
Some checks failed
CI / quick-test (push) Has been cancelled
CI / full-test (macos-latest) (push) Has been cancelled
CI / full-test (ubuntu-latest) (push) Has been cancelled
CI / full-test (windows-latest) (push) Has been cancelled
CI / integration-test (push) Has been cancelled
CI / skill-smoke (macos-latest) (push) Has been cancelled
CI / skill-smoke (ubuntu-latest) (push) Has been cancelled
CI / skill-smoke (windows-latest) (push) Has been cancelled
CI / marker-guards (push) Has been cancelled
CI / ui-smoke (push) Has been cancelled
CI / docker-ui-smoke (push) Has been cancelled
CI / docker-portable-test (push) Has been cancelled
Sync Joi Lab Fork Mirror / sync (push) Has been cancelled
CI / release-preflight (push) Has been cancelled
CI / build (dmg, macos-latest, macos-arm64, syft_1.50.0_darwin_arm64.tar.gz, syft, e32fdb9d47823fa633748a1efca2528fd77c37469ea93c9e40ab835da44e4cce) (push) Has been cancelled
CI / build (tar.gz, ubuntu-latest, linux-x86_64, syft_1.50.0_linux_amd64.tar.gz, syft, bf7b29ff57f06da30918266a0e1c2885a8f99784798d1bdb1628886aa015d788) (push) Has been cancelled
CI / build (zip, windows-latest, windows-x64, syft_1.50.0_windows_amd64.zip, syft.exe, 815ee6973ec5dff6a671d7f41b0e78835a8c45b91d5a39f4743ea1cee833d3be) (push) Has been cancelled
CI / release (push) Has been cancelled
fix(ci): release-lane smoke paths and ripgrep pin parsing
The release build lane added on 2026-08-02 (SBOM/provenance work) first ran on
the v6.88.0 tag and carried two never-exercised defects:

- The linux/windows archive smokes checked repo.bundle at the archive root,
  but PyInstaller 6 onedir places datas under _internal/ (the runtime already
  resolves the bundle root across Resources/Frameworks/_internal, and the
  macOS DMG smoke checks the .app Resources path that BUNDLE maps correctly).
- download_ripgrep_standalone.ps1 read the first whitespace token of the
  upstream .sha256 sidecar as the digest; the windows zip sidecar is prose
  ("SHA256 hash of <name>:" + hex on the next line), so the parser compared
  against the literal word 'sha256' and the pin always failed. The digest is
  now the first 64-char hex token wherever it sits, failing loudly if absent.

Co-authored-by: Ouroboros <311266734+ouroboros-agent@users.noreply.github.com>
2026-08-05 00:13:49 +03:00

37 lines
1.9 KiB
PowerShell

$ErrorActionPreference = "Stop"
$Version = if ($env:RIPGREP_VERSION) { $env:RIPGREP_VERSION } else { "14.1.1" }
$Root = "ripgrep-standalone"
$Tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("rg-" + [System.Guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Force -Path $Tmp | Out-Null
try {
$Asset = "ripgrep-$Version-x86_64-pc-windows-msvc.zip"
$Url = "https://github.com/BurntSushi/ripgrep/releases/download/$Version/$Asset"
Write-Host "Downloading $Url"
$Zip = Join-Path $Tmp $Asset
Invoke-WebRequest -Uri $Url -OutFile $Zip
$ShaFile = "$Zip.sha256"
Invoke-WebRequest -Uri "$Url.sha256" -OutFile $ShaFile
# Upstream sidecar formats differ per asset: some are "<hex> <name>", the
# windows zip ships prose ("SHA256 hash of <name>:\n<hex>"), where the old
# first-token split read the literal word "sha256" as the expected digest.
# Take the first 64-char hex token wherever it sits; fail loudly if absent.
$HexTokens = @([regex]::Matches((Get-Content $ShaFile -Raw), '\b[0-9a-fA-F]{64}\b') | ForEach-Object { $_.Value })
if ($HexTokens.Count -eq 0) {
throw "no sha256 digest found in checksum sidecar for $Asset"
}
$Expected = $HexTokens[0].ToLowerInvariant()
$Actual = (Get-FileHash -Algorithm SHA256 $Zip).Hash.ToLowerInvariant()
if ($Actual -ne $Expected) {
throw "SHA256 mismatch for $Asset`: expected $Expected, got $Actual"
}
Write-Host "Verified SHA256 for $Asset`: $Actual"
Expand-Archive -Path $Zip -DestinationPath $Tmp
if (Test-Path $Root) { Remove-Item -Recurse -Force $Root }
New-Item -ItemType Directory -Force -Path $Root | Out-Null
Copy-Item (Join-Path $Tmp "ripgrep-$Version-x86_64-pc-windows-msvc\rg.exe") (Join-Path $Root "rg.exe")
& (Join-Path $Root "rg.exe") --version
}
finally {
if (Test-Path $Tmp) { Remove-Item -Recurse -Force $Tmp }
}