From f827f4c3e5da2db0168d66a35b7a45aeb857c935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E5=B7=9D=E7=99=BD=E6=B5=AA?= <1679659@qq.com> Date: Sat, 5 Dec 2026 01:12:44 -0700 Subject: [PATCH] packaging: omit MSYS2 sources and symbols on default alpha previews [skip ci] --- .github/workflows/runtime-preview.yml | 21 ++++++++++++--- .../scripts/check-runtime-alpha.ps1 | 19 +++++++++++--- .../windows-runtime/scripts/pack-runtime.ps1 | 26 ++++++++++++++----- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/.github/workflows/runtime-preview.yml b/.github/workflows/runtime-preview.yml index b0bfd4025..ac3c321a9 100644 --- a/.github/workflows/runtime-preview.yml +++ b/.github/workflows/runtime-preview.yml @@ -25,6 +25,10 @@ on: description: "Plan a rebuild of an already published runtime using verified compatibility" type: boolean default: false + include_sources: + description: "Include MSYS2 copyleft source archive and detached debug symbols (for stable promotion)" + type: boolean + default: false permissions: contents: read @@ -247,6 +251,8 @@ jobs: - name: Package alpha runtime and source archives if: steps.plan.outputs.skip != 'true' + env: + INCLUDE_FULL_SOURCES: ${{ inputs.include_sources }} shell: pwsh run: | $ErrorActionPreference = 'Stop' @@ -255,6 +261,7 @@ jobs: # In-process call, so an empty list (every patch already upstream) binds # as an empty array rather than being dropped as an empty argument. $applied = @($env:APPLIED_PATCHES -split ',' | Where-Object { $_ }) + $full = $env:INCLUDE_FULL_SOURCES -eq 'true' & ./packaging/windows-runtime/scripts/pack-runtime.ps1 ` -ReimsRepo $env:UPSTREAM_DIR ` -UtilRepo $env:REIMS_UTIL_DIR ` @@ -268,19 +275,26 @@ jobs: -ReleaseId $env:RELEASE_ID ` -SuspendCompatID $env:SUSPEND_COMPAT_ID ` -PackagingCommit $env:GITHUB_SHA ` - -Patches $applied + -Patches $applied ` + -SkipMsys2Sources:(-not $full) ` + -SkipSymbols:(-not $full) - name: Alpha entry gate if: steps.plan.outputs.skip != 'true' + env: + INCLUDE_FULL_SOURCES: ${{ inputs.include_sources }} shell: pwsh run: | $ErrorActionPreference = 'Stop' + $full = $env:INCLUDE_FULL_SOURCES -eq 'true' & ./packaging/windows-runtime/scripts/check-runtime-alpha.ps1 ` -OutDir (Join-Path $env:RUNNER_TEMP 'releases') ` -Commit $env:RELEASE_ID -RequireSlim -RequiredCapability vm-suspend ` -RequiredSuspendCompatID $env:SUSPEND_COMPAT_ID -RequiredPackagingCommit $env:GITHUB_SHA ` -Zstd (Join-Path '${{ steps.msys2.outputs.msys2-location }}' 'usr\bin\zstd.exe') ` - -AppliedPatches @($env:APPLIED_PATCHES -split ',' | Where-Object { $_ }) + -AppliedPatches @($env:APPLIED_PATCHES -split ',' | Where-Object { $_ }) ` + -SkipMsys2Sources:(-not $full) ` + -SkipSymbols:(-not $full) - name: Upload alpha artifacts (non-release debug runs only) if: steps.plan.outputs.skip != 'true' && !(github.event_name == 'push' || github.event_name == 'schedule' || inputs.publish) @@ -320,7 +334,8 @@ jobs: $sourceRepo = $env:UPSTREAM_URL -replace '\.git$', '' $dir = Join-Path $env:RUNNER_TEMP 'releases' $assets = @("reims-runtime-win-x64-$c.tar.zst", "reims-runtime-src-$c.tar.zst", "reims-runtime-msys2-src-$c.tar.zst", "reims-runtime-symbols-$c.tar.zst", 'SHA256SUMS.txt') | - ForEach-Object { Join-Path $dir $_ } + ForEach-Object { Join-Path $dir $_ } | + Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } $applied = if ($env:APPLIED_PATCHES) { ($env:APPLIED_PATCHES -split ',' | ForEach-Object { "- ``$_``" }) -join "`n" } else { '- (none)' } $merged = if ($env:MERGED) { "`n`nAlready upstream, skipped (retire from patches/): $env:MERGED" } else { '' } $compatibility = if ($env:SUSPEND_PREDECESSOR) { "`nVerified against $env:SUSPEND_PREDECESSOR. $env:SUSPEND_VERIFICATION" } else { '' } diff --git a/packaging/windows-runtime/scripts/check-runtime-alpha.ps1 b/packaging/windows-runtime/scripts/check-runtime-alpha.ps1 index f5ce82c3a..9ce6aed42 100644 --- a/packaging/windows-runtime/scripts/check-runtime-alpha.ps1 +++ b/packaging/windows-runtime/scripts/check-runtime-alpha.ps1 @@ -30,6 +30,8 @@ param( [string]$RequiredSuspendCompatID = '', [string]$RequiredPackagingCommit = '', [switch]$RequireSlim, + [switch]$SkipMsys2Sources, + [switch]$SkipSymbols, # Only for checking packages built before the 2026-11-28 rename ("candidate"). [string]$ExpectChannel = 'alpha', [string]$TempRoot = $env:RUNNER_TEMP @@ -41,12 +43,14 @@ $AppliedPatches = @($AppliedPatches | ForEach-Object { $_ -split ',' } | ForEach $names = @{ runtime = "reims-runtime-win-x64-$Commit.tar.zst" source = "reims-runtime-src-$Commit.tar.zst" - msys2 = "reims-runtime-msys2-src-$Commit.tar.zst" sums = 'SHA256SUMS.txt' } +if (-not $SkipMsys2Sources) { + $names.msys2 = "reims-runtime-msys2-src-$Commit.tar.zst" +} $symbolsName = "reims-runtime-symbols-$Commit" -if ($RequireSlim -or (Test-Path -LiteralPath (Join-Path $OutDir "$symbolsName.tar.zst"))) { +if ((-not $SkipSymbols) -and ($RequireSlim -or (Test-Path -LiteralPath (Join-Path $OutDir "$symbolsName.tar.zst")))) { $names.symbols = "$symbolsName.tar.zst" } # 1. All assets for this layout. @@ -121,6 +125,15 @@ try { if (!(Test-Path -LiteralPath (Join-Path $root $rel) -PathType Leaf)) { throw "Missing runtime dependency: $rel" } } Write-Host 'PASS stripped executable hashes, detached debug members and video driver files' + } elseif ($RequireSlim) { + foreach ($rel in 'bin/reims-ctl.exe','bin/reims-util.exe','qemu/bin/qemu-system-x86_64.exe','qemu/bin/qemu-img.exe','qemu/bin/reims-vgpu-compile.exe') { + $hash = (Get-FileHash -LiteralPath (Join-Path $root $rel) -Algorithm SHA256).Hash + if ($hash -ne $m.sha256.$rel) { throw "Manifest hash mismatch for $rel" } + } + foreach ($rel in 'qemu/bin/libva.dll','qemu/bin/libva_win32.dll','qemu/bin/vaon12_drv_video.dll','NOTICE.md','MSYS2-PACKAGES.txt') { + if (!(Test-Path -LiteralPath (Join-Path $root $rel) -PathType Leaf)) { throw "Missing runtime dependency: $rel" } + } + Write-Host 'PASS stripped executable hashes and video driver files (light alpha)' } # 4. QEMU runs from the bundle alone and has the reims device. @@ -139,7 +152,7 @@ try { if ($proc.ExitCode -ne 0) { throw "qemu -device help exited $($proc.ExitCode): $err" } if ($out -notmatch 'reims-graphics-pci') { throw "qemu -device help does not list reims-graphics-pci`n$out`n$err" } Write-Host 'PASS qemu-system-x86_64 -device help lists reims-graphics-pci (no MSYS2 on PATH)' - if ($names.symbols) { + if ($names.symbols -or $RequireSlim) { $oldPath = $env:PATH $img = Join-Path $qemuBin 'qemu-img.exe' try { diff --git a/packaging/windows-runtime/scripts/pack-runtime.ps1 b/packaging/windows-runtime/scripts/pack-runtime.ps1 index 841de1a3d..2d80c25b4 100644 --- a/packaging/windows-runtime/scripts/pack-runtime.ps1 +++ b/packaging/windows-runtime/scripts/pack-runtime.ps1 @@ -55,7 +55,12 @@ param( [string]$PackagingCommit = '', # Names from patches/series.txt actually applied. Not given: all of them. # Given but empty: none (every patch already upstream). - [string[]]$Patches = @() + [string[]]$Patches = @(), + # Omit the 110 MB MSYS2 copyleft source bundle (e.g. for frequent alpha previews; + # include for stable releases or dedicated toolchain source releases). + [switch]$SkipMsys2Sources, + # Omit the ~95 MB detached debug symbols archive (binaries are still stripped). + [switch]$SkipSymbols ) $ErrorActionPreference = 'Stop' @@ -579,7 +584,6 @@ $manifest = [ordered]@{ capabilities = $capabilities channel = $Channel source_package = "$srcName.tar.zst" - symbols_package = "$symbolsName.tar.zst" qemu_version = $qemuVersionLine util_version = $utilVersionLine built_at = (Get-Date).ToString('o') @@ -588,6 +592,7 @@ $manifest = [ordered]@{ raw_bytes = [int64]((Get-ChildItem -LiteralPath $bundleDir -Recurse -File | Measure-Object Length -Sum).Sum) # Add the manifest's own size after writing it below. sha256 = $hashes } +if (-not $SkipSymbols) { $manifest['symbols_package'] = "$symbolsName.tar.zst" } if ($SuspendCompatID) { $manifest['suspend_compat_id'] = $SuspendCompatID } if ($PackagingCommit) { $manifest['packaging_commit'] = $PackagingCommit } Write-Utf8 "$bundleDir\manifest.json" ($manifest | ConvertTo-Json -Depth 5) @@ -602,16 +607,25 @@ New-TarZst $stageRoot $bundleName $runtimeArchive Write-Host '==> Compressing sources' $srcArchive = Join-Path $OutDir "$srcName.tar.zst" New-TarZst $stageRoot $srcName $srcArchive -$symbolsArchive = Join-Path $OutDir "$symbolsName.tar.zst" -New-TarZst $stageRoot $symbolsName $symbolsArchive $rtHash = Get-Sha256 $runtimeArchive $srcHash = Get-Sha256 $srcArchive Write-Utf8 "$runtimeArchive.sha256" "$rtHash $bundleName.tar.zst`n" -Write-Utf8 (Join-Path $OutDir 'SHA256SUMS.txt') "$rtHash $bundleName.tar.zst`n$srcHash $srcName.tar.zst`n$(Get-Sha256 $symbolsArchive) $symbolsName.tar.zst`n" +$sumsLines = @( + "$rtHash $bundleName.tar.zst" + "$srcHash $srcName.tar.zst" +) +if (-not $SkipSymbols) { + $symbolsArchive = Join-Path $OutDir "$symbolsName.tar.zst" + New-TarZst $stageRoot $symbolsName $symbolsArchive + $sumsLines += "$(Get-Sha256 $symbolsArchive) $symbolsName.tar.zst" +} +Write-Utf8 (Join-Path $OutDir 'SHA256SUMS.txt') (($sumsLines -join "`n") + "`n") # Sources of the copyleft MSYS2 packages, as their own asset (adds a line to SHA256SUMS.txt). -& (Join-Path $PSScriptRoot 'pack-msys2-sources.ps1') -PackagesFile (Join-Path $bundleDir 'MSYS2-PACKAGES.txt') -Commit $id -OutDir $OutDir -Msys2 $Msys2 -TempRoot $TempRoot +if (-not $SkipMsys2Sources) { + & (Join-Path $PSScriptRoot 'pack-msys2-sources.ps1') -PackagesFile (Join-Path $bundleDir 'MSYS2-PACKAGES.txt') -Commit $id -OutDir $OutDir -Msys2 $Msys2 -TempRoot $TempRoot +} Remove-Item -Recurse -Force -LiteralPath $stageRoot