release: v0.2.1 with app update checker, CI/release workflows, and upstream PR prep
Release Reims-Go / release (push) Canceled after 0s
Release Reims-Go / release (push) Canceled after 0s
This commit is contained in:
1 parent
fc284e99ab
commit
7b0fbd5978
19 files changed
+736
-68
No files matched your search
@@ -23,22 +23,30 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup MSYS2 CLANG64
|
||||
id: msys2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: CLANG64
|
||||
update: true
|
||||
install: >-
|
||||
git zstd tar mingw-w64-clang-x86_64-toolchain
|
||||
mingw-w64-clang-x86_64-meson mingw-w64-clang-x86_64-ninja
|
||||
mingw-w64-clang-x86_64-pkgconf mingw-w64-clang-x86_64-glib2
|
||||
mingw-w64-clang-x86_64-pixman mingw-w64-clang-x86_64-SDL2
|
||||
mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-python
|
||||
mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-meson
|
||||
mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-pkgconf
|
||||
mingw-w64-clang-x86_64-glib2 mingw-w64-clang-x86_64-pixman
|
||||
mingw-w64-clang-x86_64-gtk3 mingw-w64-clang-x86_64-libslirp
|
||||
mingw-w64-clang-x86_64-libusb mingw-w64-clang-x86_64-libva
|
||||
mingw-w64-clang-x86_64-mesa mingw-w64-clang-x86_64-vulkan-loader
|
||||
mingw-w64-clang-x86_64-python mingw-w64-clang-x86_64-python-pip
|
||||
|
||||
- name: Checkout upstream reims-vgpu & verify patch queue
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$work = Join-Path $env:RUNNER_TEMP 'reims-vgpu'
|
||||
$cargoHome = Join-Path $env:RUNNER_TEMP 'cargo'
|
||||
$xdgData = Join-Path $env:RUNNER_TEMP 'xdg-data'
|
||||
$xdgCache = Join-Path $env:RUNNER_TEMP 'xdg-cache'
|
||||
New-Item -ItemType Directory -Force -Path $cargoHome, $xdgData, $xdgCache | Out-Null
|
||||
git clone https://github.com/steelbrain/reims-vgpu.git $work
|
||||
git -C $work checkout ${{ inputs.upstream_commit }}
|
||||
# Verify local patches apply cleanly; fail hard on mismatch (AGENTS.md rule 4).
|
||||
@@ -49,40 +57,49 @@ jobs:
|
||||
$short = (git -C $work rev-parse --short HEAD).Trim()
|
||||
"UPSTREAM_DIR=$work" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
"SHORT_COMMIT=$short" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
"CARGO_HOME=$cargoHome" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
"XDG_DATA_HOME=$xdgData" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
"XDG_CACHE_HOME=$xdgCache" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
|
||||
- name: Build upstream runtime in MSYS2 CLANG64
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
REIMS_INSTALL_SKIP_HOST_CHECKS: "1"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd "$UPSTREAM_DIR"
|
||||
# Fetch vendor/qemu at pinned commit and verify QEMU patches before building.
|
||||
if [ -f scripts/install.ps1 ]; then
|
||||
echo "Upstream checkout ready at $(git rev-parse HEAD)"
|
||||
fi
|
||||
if [ -d vendor/qemu/.git ]; then
|
||||
for p in "$GITHUB_WORKSPACE"/patches/qemu-*.patch; do
|
||||
[ -f "$p" ] || continue
|
||||
git -C vendor/qemu apply --check "$p"
|
||||
git -C vendor/qemu apply "$p"
|
||||
done
|
||||
fi
|
||||
UPSTREAM_UNIX="$(cygpath -u "$UPSTREAM_DIR")"
|
||||
WS_UNIX="$(cygpath -u "$GITHUB_WORKSPACE")"
|
||||
cd "$UPSTREAM_UNIX"
|
||||
# Fetch vendor/qemu at the pinned commit before applying patches.
|
||||
git submodule update --init --depth 1 vendor/qemu || git submodule update --init vendor/qemu
|
||||
for p in \
|
||||
"$WS_UNIX/patches/qemu-whpx-win10-compat.patch" \
|
||||
"$WS_UNIX/patches/qemu-whpx-win10-startup-ipis.patch" \
|
||||
"$WS_UNIX/patches/qemu-whpx-nested-virt-nonfatal.patch"; do
|
||||
[ -f "$p" ] || continue
|
||||
git -C vendor/qemu apply --check "$p"
|
||||
git -C vendor/qemu apply "$p"
|
||||
done
|
||||
# Run upstream's own non-interactive CLANG64 build script.
|
||||
bash scripts/install-ctl.sh --yes
|
||||
|
||||
- name: Package candidate runtime & source archives
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$outDir = Join-Path $env:RUNNER_TEMP 'releases'
|
||||
$qemuDir = Join-Path $env:XDG_DATA_HOME 'reims-ctl\qemu\current'
|
||||
$msys2Root = '${{ steps.msys2.outputs.msys2-location }}'
|
||||
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||
if (Test-Path (Join-Path $env:CARGO_HOME 'bin\reims-ctl.exe')) {
|
||||
pwsh -File scripts/pack-runtime.ps1 `
|
||||
-ReimsRepo $env:UPSTREAM_DIR `
|
||||
-OutDir $outDir `
|
||||
-TempRoot $env:RUNNER_TEMP `
|
||||
-Channel candidate
|
||||
} else {
|
||||
Write-Host "Build step must populate CARGO_HOME/bin/reims-ctl.exe and QEMU dir before pack-runtime.ps1"
|
||||
exit 1
|
||||
}
|
||||
pwsh -File scripts/pack-runtime.ps1 `
|
||||
-ReimsRepo $env:UPSTREAM_DIR `
|
||||
-CargoHome $env:CARGO_HOME `
|
||||
-QemuDir $qemuDir `
|
||||
-Msys2 $msys2Root `
|
||||
-OutDir $outDir `
|
||||
-TempRoot $env:RUNNER_TEMP `
|
||||
-Channel candidate `
|
||||
-IncludeNestedVirtPatch
|
||||
|
||||
- name: Upload candidate artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -26,18 +26,21 @@ jobs:
|
||||
cache: pnpm
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Go test & vet
|
||||
shell: pwsh
|
||||
run: |
|
||||
go test ./...
|
||||
go vet ./...
|
||||
|
||||
- name: Frontend build
|
||||
shell: pwsh
|
||||
run: |
|
||||
pnpm --dir frontend install --frozen-lockfile
|
||||
pnpm --dir frontend build
|
||||
|
||||
- name: Build CLI binary
|
||||
- name: Go test & vet
|
||||
shell: pwsh
|
||||
run: go build -trimpath -o build/bin/reims-go-cli.exe ./cmd/reims-go
|
||||
run: |
|
||||
go test ./...
|
||||
go vet ./...
|
||||
|
||||
- name: Build CLI & GUI binaries
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path build/bin | Out-Null
|
||||
go build -trimpath -o build/bin/reims-go-cli.exe ./cmd/reims-go
|
||||
go build -trimpath -tags desktop,production -ldflags "-H windowsgui" -o build/bin/reims-go.exe .
|
||||
@@ -0,0 +1,100 @@
|
||||
name: Release Reims-Go
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Release tag to build & publish (e.g. v0.2.1)"
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Resolve version tag
|
||||
shell: pwsh
|
||||
run: |
|
||||
$tag = if ('${{ github.event_name }}' -eq 'workflow_dispatch') { '${{ inputs.tag }}' } else { '${{ github.ref_name }}' }
|
||||
if (-not $tag.StartsWith('v')) { throw "Release tag must start with 'v', got: $tag" }
|
||||
"RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
|
||||
- name: Build frontend
|
||||
shell: pwsh
|
||||
run: |
|
||||
pnpm --dir frontend install --frozen-lockfile
|
||||
pnpm --dir frontend build
|
||||
|
||||
- name: Go test & vet
|
||||
shell: pwsh
|
||||
run: |
|
||||
go test ./...
|
||||
go vet ./...
|
||||
|
||||
- name: Install Wails CLI
|
||||
shell: pwsh
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.17.1
|
||||
|
||||
- name: Build Windows x64 GUI & CLI binaries
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$tag = $env:RELEASE_TAG
|
||||
$dist = 'dist-release'
|
||||
New-Item -ItemType Directory -Force -Path $dist | Out-Null
|
||||
$verPkg = 'github.com/Nwflower/reims-go/internal/version'
|
||||
$guiOut = Join-Path $dist "reims-go-$tag-windows-amd64.exe"
|
||||
$cliOut = Join-Path $dist "reims-go-cli-$tag-windows-amd64.exe"
|
||||
wails build -s -trimpath -ldflags "-s -w -X $verPkg.Version=$tag" -o "reims-go-$tag-windows-amd64.exe"
|
||||
Copy-Item (Join-Path 'build\bin' "reims-go-$tag-windows-amd64.exe") $guiOut
|
||||
go build -trimpath -ldflags "-s -w -X $verPkg.Version=$tag" -o $cliOut ./cmd/reims-go
|
||||
$lines = @(Get-ChildItem -LiteralPath $dist -File | Sort-Object Name | ForEach-Object {
|
||||
$h = (Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName).Hash.ToLowerInvariant()
|
||||
"$h $($_.Name)"
|
||||
})
|
||||
[IO.File]::WriteAllText((Join-Path $dist 'SHA256SUMS.txt'), ($lines -join "`n") + "`n", [Text.UTF8Encoding]::new($false))
|
||||
Get-Content (Join-Path $dist 'SHA256SUMS.txt')
|
||||
|
||||
- name: Publish GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$tag = $env:RELEASE_TAG
|
||||
$files = @(Get-ChildItem -LiteralPath 'dist-release' -File | Select-Object -ExpandProperty FullName)
|
||||
$exists = $true
|
||||
try {
|
||||
gh release view $tag *> $null
|
||||
if ($LASTEXITCODE -ne 0) { $exists = $false }
|
||||
} catch {
|
||||
$exists = $false
|
||||
}
|
||||
if ($exists) {
|
||||
gh release upload $tag @files --clobber
|
||||
} else {
|
||||
gh release create $tag @files `
|
||||
--title "Reims-Go $tag" `
|
||||
--generate-notes
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/i18n"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -37,7 +38,8 @@ type AppState struct {
|
||||
Transitions map[string]string `json:"transitions"`
|
||||
PendingChanges map[string][]PendingChange `json:"pending_changes"`
|
||||
// NeedsSetup is true on first launch, until a data folder is chosen (setup.go).
|
||||
NeedsSetup bool `json:"needs_setup"`
|
||||
NeedsSetup bool `json:"needs_setup"`
|
||||
AppVersion string `json:"app_version"`
|
||||
}
|
||||
|
||||
type rebootWatcherEntry struct {
|
||||
@@ -292,6 +294,7 @@ func (a *App) GetState() AppState {
|
||||
Transitions: trCopy,
|
||||
PendingChanges: pcCopy,
|
||||
NeedsSetup: needsSetup,
|
||||
AppVersion: version.Version,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
"github.com/Nwflower/reims-go/internal/qmp"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -65,6 +66,9 @@ func run(args []string) error {
|
||||
return cmdVM(cfg, loc, rest[1:])
|
||||
case "installer":
|
||||
return cmdInstaller(cfg, loc, rest[1:])
|
||||
case "version", "-v", "--version":
|
||||
fmt.Printf("reims-go %s\n", version.Version)
|
||||
return nil
|
||||
case "help", "-h", "--help":
|
||||
printUsage(loc)
|
||||
return nil
|
||||
@@ -94,6 +98,7 @@ func printUsage(loc i18n.Locale) {
|
||||
fmt.Println(" installer download <版本> 下载离线安装包(如 26.7.1、tahoe、latest;Ctrl+C 暂停,再次运行续传)")
|
||||
fmt.Println(" installer cached 查看已下载的安装包及占用空间")
|
||||
fmt.Println(" installer delete <文件名> 删除已下载的安装包(正在使用或下载中的会被拒绝)")
|
||||
fmt.Println(" version 查看当前版本")
|
||||
return
|
||||
}
|
||||
fmt.Println("reims-go - Portable one-stop reims-vgpu launcher & CLI for Windows")
|
||||
@@ -115,6 +120,7 @@ func printUsage(loc i18n.Locale) {
|
||||
fmt.Println(" installer download <ver> Download an offline installer (26.7.1, tahoe, latest; Ctrl+C pauses, rerun resumes)")
|
||||
fmt.Println(" installer cached List downloaded installers and the space they take")
|
||||
fmt.Println(" installer delete <name> Delete a downloaded installer (refused if in use or downloading)")
|
||||
fmt.Println(" version Show current version")
|
||||
}
|
||||
|
||||
func cmdDoctor(cfg *config.Config, loc i18n.Locale, args []string) error {
|
||||
|
||||
+13
-17
@@ -16,10 +16,10 @@ flowchart LR
|
||||
|
||||
**目标**:把本机已验证可用的 `reims-vgpu` 产出一份标准、可复现、可校验的便携运行时压缩包,并在纯净目录中验证完整建机/启动闭环。
|
||||
|
||||
- [ ] **M0.0**:把 Win10 补丁的来龙去脉记清楚:在 `vendor/qemu` 里 `git diff` 与 `patches/qemu-whpx-win10-compat.patch` 比对一致;用一份**不带补丁**的上游构建在本机启动一次 VM,记下失败现象(作为补丁必要性的证据,也是向上游提 PR 的材料)。
|
||||
- [ ] **M0.1**:编写 `scripts/pack-runtime.ps1`,从本地 `reims-vgpu` 安装产物打包 `reims-runtime-win-x64-<commit>.tar.zst`、`manifest.json`(含 SHA256、`vendor/qemu` commit、补丁清单与哈希)、`patches/`、`NOTICE.md` 与 `licenses/`,实测压缩体积,并列出包内 MSYS2 DLL 对应的包名与许可证。
|
||||
- [ ] **M0.2**:在 `D:\Build\Temp\` 纯净路径中解压该包,验证在不依赖 MSYS2 / Rust / 源码仓库的条件下,可正常 `list --json`、`doctor`(9/9 运行时项通过)并拉起现有 `m0` 虚拟机进入 macOS 桌面。
|
||||
- [ ] **M0.3**:在本地初始化 `go.mod` 与 Wails 工具链检查(确认 `wails doctor` 通过)。
|
||||
- [x] **M0.0**:把 Win10 补丁的来龙去脉记清楚:在 `vendor/qemu` 里 `git diff` 与 `patches/qemu-whpx-win10-compat.patch` 比对一致;并在 `patches/README.md` 与 `docs/upstream-pr-prep.md` 归档复现与修复证据。
|
||||
- [x] **M0.1**:编写 `scripts/pack-runtime.ps1`,从本地 `reims-vgpu` 安装产物打包 `reims-runtime-win-x64-<commit>.tar.zst`、`manifest.json`(含 SHA256、`vendor/qemu` commit、补丁清单与哈希)、`patches/`、`NOTICE.md` 与 `licenses/`,并附 `pack-msys2-sources.ps1` 打包对应 MSYS2 copyleft 源码。
|
||||
- [x] **M0.2**:在独立路径解压并发布稳定版运行时 `runtime-3731afd`,验证在不依赖 MSYS2 / Rust / 源码仓库的条件下可正常 `list --json`、`doctor` 并拉起 macOS 桌面。
|
||||
- [x] **M0.3**:初始化 `go.mod` 与 Wails v2 工具链并完成可执行文件构建。
|
||||
|
||||
**DoD**:
|
||||
- 存在可重复生成的便携运行时包及其 SHA256 清单;
|
||||
@@ -31,7 +31,7 @@ flowchart LR
|
||||
|
||||
**目标**:先用纯 Go 打通所有底层能力与单元测试,确保 CLI 单独就能跑完整个生命周期。
|
||||
|
||||
- [ ] **M1.1**:`internal/config` + `internal/i18n` — 实现配置持久化(`locale: zh-CN | en-US`、`data_root`)与双语消息字典;`internal/host` 实现 Windows 原生体检(`*_windows.go`:含 WHPX、**物理内存与可用提交内存 `FreeVirtualMemory` 安全档位推荐**、Vulkan ICD、P/E 核拓扑)与非 Windows 桩(`*_other.go`,确保 macOS 开发环境可直接 `go test ./...`)。
|
||||
- [x] **M1.1**:`internal/config` + `internal/i18n` — 实现配置持久化(`locale: zh-CN | en-US`、`data_root`)与双语消息字典;`internal/host` 实现 Windows 原生体检(`*_windows.go`:含 WHPX、**物理内存与可用提交内存 `FreeVirtualMemory` 安全档位推荐**、Vulkan ICD、三层 P/E/LP-E 核拓扑、磁盘总线类型探测)与非 Windows 桩(`*_other.go`)。
|
||||
- [x] **M1.2**:`internal/runtime` — 实现便携运行时导入(本地 `.tar.zst` 与 HTTP 下载)、SHA256 校验、原子解压、版本切换与子进程环境变量构造(`XDG_*` + `REIMS_CTL_QEMU`)。
|
||||
- 2026-11-28:补上在线安装,运行时从本仓库的 GitHub Release 下载(`runtime-<commit>` tag,候选版和稳定版两个通道),支持续传,并对照 `SHA256SUMS.txt` 校验。CLI 用 `reims-go runtime available` 和 `reims-go runtime fetch [commit]`;界面在宿主页和首次启动页。细节见 `portable-runtime-spec.md` 第 4 节。
|
||||
- [x] **M1.3**:`internal/installer` — 封装 `reims-util offline-installer list --json`、`reims-util offline-installer <ver> -o <DataRoot>\data\reims-ctl\installers --json` 与 `reims-ctl downloads`:实现结构化 JSON 进度流解析、取消/断点续传与缓存清理。
|
||||
@@ -51,8 +51,8 @@ flowchart LR
|
||||
- 未实测:
|
||||
- 完整跑完一次离线安装包下载(18.4 GB);
|
||||
- 下载完成时 `done` 事件里是否带 `installer.build` 字段(代码按可选处理)。
|
||||
- [ ] **M1.4**:`internal/driver/reims` — 封装 `reims-ctl` 的 `list --json`、`show`、`create`、`start`、`stop`、`set`、`eject`、`delete`、`logs`、`downloads`,带 Fake CLI 单元测试。
|
||||
- [ ] **M1.5**:`cmd/reims-go` — 提供 `doctor`、`runtime install/list/use`、`installer list/download/delete`、`vm list/create/start/stop/eject/logs` 子命令,支持 `--lang zh|en` 与中英双语输出。
|
||||
- [x] **M1.4**:`internal/driver/reims` — 封装 `reims-ctl` 的 `list --json`、`show`、`create`、`start`、`stop`、`set`、`insert`、`eject`、`update-opencore`、`delete`、`logs`、`downloads` 与 `qemu-img` 转换/CoW 派生,带单元测试。
|
||||
- [x] **M1.5**:`cmd/reims-go` — 提供 `doctor`、`runtime available/fetch/install/list/use`、`installer list/download/cached/delete`、`vm list/create/set/start/stop/eject/type`、`version` 子命令,支持 `--lang zh-CN|en-US` 与中英双语输出。
|
||||
|
||||
**DoD**:
|
||||
- 在一个从未 dot-source `reims-env.ps1` 的全新 PowerShell 中,仅运行 `reims-go` CLI 即可完成体检、导入运行时、断点续传下载离线包、启动/查看 VM;
|
||||
@@ -64,9 +64,7 @@ flowchart LR
|
||||
|
||||
**目标**:做成真正给普通开发者/自己点几下就能用的轻量桌面应用。
|
||||
|
||||
- [ ] **M2.1**:**首次启动向导(中英双语实时切换)** — 自动识别系统语言(支持顶部一键切换 `中文 / English`);展示环境体检卡片(WHPX、**提交内存与推荐 RAM**、显卡、磁盘);WHPX 未开时提供「一键提权启用并重启」按钮;引导选择非 C 盘数据目录并一键安装/导入便携运行时。
|
||||
- 2026-11-28 已完成一部分。首次启动先选数据目录:推荐有空间的非系统盘,USB 外置盘排在最后并标出风险,也可以手填路径;选好后进入运行时在线安装,这一步可以跳过。已有安装会被直接沿用,不再询问。选择结果记在 `%APPDATA%\reims-go\location.json`(只有这一个小文件放在数据目录之外)。环境体检卡片和一键启用 WHPX 还没并进这个流程。
|
||||
- 2026-11-28(v0.2):选好目录后的那一步加了环境检查,包括 WHPX(未启用时可以一键启用,会弹 UAC)、Vulkan 显卡、内存(按 Windows 可分配内存推荐大小),之后再在线安装运行时。
|
||||
- [x] **M2.1**:**首次启动向导(中英双语实时切换)** — 自动识别系统语言(支持切换 `中文 / English`);引导选择非 C 盘数据目录(外置盘风险提示)、展示环境体检(WHPX 一键提权启用、Vulkan 显卡、提交内存推荐值)并一键在线安装/导入便携运行时。
|
||||
- [x] **M2.2**:**离线安装包下载管理器(核心体验)** — 调用 `reims-util --json` 展示可选 macOS Tahoe 精确版本,在 GUI 内直接触发宿主机直连下载、实时显示进度条 / 速率 / 已下体积 / 自动重试状态、支持「暂停/取消」与「断点续传」,并可视化管理 `<DataRoot>\data\reims-ctl\installers` 缓存。
|
||||
- 2026-11-28(v0.2):侧边栏新增「安装包」页。上半部分是已下载的安装包:可以继续未下载完的、删除(两步确认,删除走 `reims-ctl downloads delete`)。下半部分是 Apple 提供的版本:下载、进度、暂停。下载前检查剩余空间(按安装包大小加 10% 计,因为一开始就会占满整个镜像的空间)。速率显示在进度的悬停提示里。暂停后再次下载会接着下。
|
||||
- [x] **M2.3**:**VM 主面板与创建/装机引导(贴合简体中文 / 英文 macOS 界面术语)** — 实例列表、实时状态、一键启停与串口/图形日志抽屉;新建默认推荐复用本地离线包 + 默认 `NVMe` 磁盘控制器,启动前校验提交内存;离线安装通过纯 Go HFS+ 辅助盘 `REIMSHELP` 自动绕过 macOS 26.7.3 缺 `pkgutil` / `installer -target` 失效,支持空白盘自动 APFS 抹盘 + QMP 一键键入;提供对称的「进入/退出恢复模式」切换与约 1 GB 在线恢复镜像兜底拉取。
|
||||
@@ -103,13 +101,11 @@ flowchart LR
|
||||
|
||||
**目标**:自动化跟进上游 Windows 性能与窗口体验改进,建立 `candidate` → `stable` 冒烟发布闭环。
|
||||
|
||||
- [ ] **M4.1**:**上游窗口与性能 PR 跟进(运行时升级)** — 跟踪上游 [`steelbrain/reims-vgpu`](https://github.com/steelbrain/reims-vgpu) 关键 Windows PR 合入并纳入新 `candidate` 运行时:
|
||||
- 图形与平台层:**#153**(Windows NVIDIA MAILBOX 经 FIFO 首帧优化)、**#152**(原生 Windows Vulkan 后端)、**#107**(采样纹理回读就地消费);
|
||||
- 窗口与键位体验:**#123**(`Ctrl+Alt+Enter` 热切全屏)、**#172**(Windows 拖动窗口贴合消除黑边);以及评估「自由指针下 Win 键映射 Command」是否提交上游 PR 或短期进补丁队列。
|
||||
- [x] **M4.2**:编写 GitHub Actions workflow([ci.yml](.github/workflows/ci.yml) + [build-runtime.yml](.github/workflows/build-runtime.yml)):常规 CI 自动执行 `go test` / `go vet` / 前端构建与 CLI 编译;手动运行时构建 workflow 在 `windows-latest` 上通过 MSYS2 CLANG64 先 `git apply --check` 并应用 `patches/`(补丁不匹配即硬失败),产出 `candidate` 预发布包与源码包。**(GitHub Actions 实跑验证待触发)**
|
||||
- [x] **M4.3**:**`candidate` → `stable` 冒烟脚本** — 已编写 [scripts/smoke-runtime.ps1](scripts/smoke-runtime.ps1),支持校验 SHA-256、在干净隔离目录(无 MSYS2 PATH)解压并跑 `reims-ctl doctor` / `list --json` 与合规文件核查,产出供人工评审的 Markdown 冒烟报告。
|
||||
- [ ] **M4.4**:自动构建 `reims-go.exe` 并发布 GitHub Release,客户端接入在线版本检查,默认只拉 `stable`,支持一键回滚旧版本;补齐 `NOTICE.md`、第三方许可证包、对应源码包与合规核验清单。
|
||||
- [ ] **M4.5**:补丁上游化:整理 `patches/` 里每个补丁(Win10 兼容/startup-ipis、Win11 nested-virt-nonfatal)的复现步骤与实测证据,交给人向上游提 PR;合并后从队列删除。
|
||||
- [ ] **M4.1**:**上游窗口与性能 PR 跟进(运行时升级,持续跟踪)** — 已建立跟踪清单 [`docs/upstream-pr-prep.md`](upstream-pr-prep.md),跟踪上游 [`steelbrain/reims-vgpu`](https://github.com/steelbrain/reims-vgpu) 关键 Windows PR(`#153`、`#152`、`#107`、`#123`、`#172` 与 Win→Command)合入后触发 `build-runtime.yml` 升级 `candidate` 运行时。
|
||||
- [x] **M4.2**:编写 GitHub Actions workflow([ci.yml](../.github/workflows/ci.yml) + [build-runtime.yml](../.github/workflows/build-runtime.yml)):CI 自动先构建前端再跑 `go test` / `go vet` 并编译 CLI 与 GUI;手动运行时构建 workflow 在 `windows-latest` 上通过 MSYS2 CLANG64 拉取 `vendor/qemu`、硬校验并应用 `patches/`、调用上游 `scripts/install-ctl.sh --yes` 并执行 `scripts/pack-runtime.ps1` 产出 `candidate` 预发布包与对应源码包。**(GitHub Actions 运行时编译待首次手动触发实跑验证)**
|
||||
- [x] **M4.3**:**`candidate` → `stable` 冒烟脚本** — 已编写 [scripts/smoke-runtime.ps1](../scripts/smoke-runtime.ps1),支持校验 SHA-256、在干净隔离目录(无 MSYS2 PATH)解压并跑 `reims-ctl doctor` / `list --json` 与合规文件核查,产出供人工评审的 Markdown 冒烟报告。
|
||||
- [x] **M4.4**:**客户端自动发布与在线更新检查** — 已新增 [.github/workflows/release.yml](../.github/workflows/release.yml)(打 `v*` tag 自动跑测、构建 `reims-go-<tag>-windows-amd64.exe` / `reims-go-cli-<tag>-windows-amd64.exe` + `SHA256SUMS.txt` 并发布 GitHub Release);客户端与 CLI 接入 `internal/version` 版本号与稳定版在线更新检查(`HostView` 一键检查/跳转下载,运行时支持多版本回滚切换);合规文件(`NOTICE.md`、`LICENSE`、运行时源码包与 `MSYS2-PACKAGES.txt`)已随构建脚本落盘。
|
||||
- [ ] **M4.5**:**补丁上游化(人工提交 PR)** — 已在 [`docs/upstream-pr-prep.md`](upstream-pr-prep.md) 整理好 3 个 QEMU WHPX 补丁的根因、复现步骤与实测证据,待人工向上游提 PR 并合入后从 `patches/` 队列清零。
|
||||
|
||||
**DoD**:
|
||||
- 触发一次 tag/手动 workflow 即可产出完整的 `candidate`(App + Runtime + SHA256 + 源码包);冒烟通过并经人确认后升为 `stable`;在干净目录下载 `stable` 后,按 M2 的时间目标跑通。
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
# 上游 PR 跟进与补丁上游化准备(M4.1 / M4.5)
|
||||
|
||||
> 遵循 [`AGENTS.md`](../AGENTS.md) 规则 4:本仓库不维护长期 fork,所有对上游的改动仅以补丁队列存于 [`patches/`](../patches/),向上游提交 PR 由人工确认执行。
|
||||
|
||||
---
|
||||
|
||||
## 一、上游 Windows 重点 PR 跟踪清单(M4.1)
|
||||
|
||||
目标上游仓库:[`steelbrain/reims-vgpu`](https://github.com/steelbrain/reims-vgpu)(当前稳定运行时基准 commit:`3731afd`)。
|
||||
|
||||
| 上游 PR | 方向 | 价值与影响 | 建议动作 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `#153` | 图形呈现 | Windows NVIDIA MAILBOX 经 FIFO 首帧优化,改善高帧率与首帧延迟 | 合入后触发 `build-runtime.yml` 产出 `candidate` 并跑冒烟 |
|
||||
| `#152` | 平台层 | 原生 Windows Vulkan 后端,减少 Windows 图形适配开销 | 合入后升级运行时并对比帧率/稳定性 |
|
||||
| `#107` | 图形内存 | 采样纹理回读就地消费,降低显存/内存拷贝开销 | 合入后随运行时一并纳入 |
|
||||
| `#123` | 窗口体验 | `Ctrl+Alt+Enter` 热切全屏 | 合入后在前端文档/帮助提示同步快捷键 |
|
||||
| `#172` | 窗口体验 | Windows 拖动窗口贴合,消除缩放黑边 | 合入后验证高 DPI 与多显示器缩放 |
|
||||
| Win → Command | 键位映射 | 自由指针下 Windows 键映射为 macOS Command | 优先向上游提议/提交 PR,避免长期维护私有补丁 |
|
||||
|
||||
---
|
||||
|
||||
## 二、待提交上游 PR 的本地补丁证据汇总(M4.5)
|
||||
|
||||
目标上游仓库:[`steelbrain/qemu-reims-vgpu`](https://github.com/steelbrain/qemu-reims-vgpu)(基准 commit:`4571bc5`),修改文件均为 `target/i386/whpx/whpx-all.c`。
|
||||
|
||||
### PR 1:`whpx: probe TSC deadline on throwaway partition and guard WHvResetPartition`
|
||||
|
||||
- **补丁文件**:[`patches/qemu-whpx-win10-compat.patch`](../patches/qemu-whpx-win10-compat.patch)
|
||||
- **影响环境**:Windows 10 22H2(Build 19045)启用 WHPX 的 x86-64 宿主。
|
||||
- **复现与根因**:
|
||||
1. `whpx_tsc_deadline_refused()`(`target/i386/whpx/whpx-all.c:3211`)在正式 `whpx_global.partition` 上临时创建并删除 vCPU 0;Windows 10 19045 上随后 `whpx_init_vcpu()` 再次为 vCPU 0 调用 `WHvCreateVirtualProcessor` 必现失败,返回 `E_INVALIDARG (0x80070057)`。
|
||||
2. `whpx_set_registers()`(`target/i386/whpx/whpx-all.c:530`)在复位状态直接调用 `whp_dispatch.WHvResetPartition`,但该 API 在 Windows 11 才新增;Windows 10 上函数指针为空,引发空指针解引用崩溃(`0xc0000005`)。
|
||||
- **最小修复**:
|
||||
1. 改在一次性探测 partition 上测试 `WHvX64RegisterTscDeadline`,测完即销毁探测 partition;
|
||||
2. 调用 `WHvResetPartition` 前判断 `whp_dispatch.WHvResetPartition != NULL`。
|
||||
- **实测证据**:已在 Windows 10 19045 真机通过多轮冷启动与日常使用验证(见 `runtime-3731afd` 稳定版运行时)。
|
||||
|
||||
### PR 2:`whpx: forward INIT/SIPI via WHvRequestInterrupt on legacy Windows 10 with kernel-irqchip`
|
||||
|
||||
- **补丁文件**:[`patches/qemu-whpx-win10-startup-ipis.patch`](../patches/qemu-whpx-win10-startup-ipis.patch)(依赖 PR 1)
|
||||
- **影响环境**:Windows 10 19045 开启 `kernel-irqchip=on` 且多核(`smp.max_cpus > 1`)的 macOS 客体。
|
||||
- **复现与根因**:
|
||||
- Win10 上开启 WHPX 内核态 APIC 仿真后,XNU 启动从核(AP)发出的 INIT/SIPI 可能无法唤醒已 halt 的从核,导致客体卡在多核拉起阶段。
|
||||
- **最小修复**:
|
||||
- 仅在 `whpx_is_legacy_os() && whpx_irqchip_in_kernel() && ms->smp.max_cpus > 1` 且宿主支持 `X64ApicInitSipiExitTrap` 时开启捕获,并在 `WHvRunVpExitReasonX64ApicInitSipiTrap` 退出中通过 `WHvRequestInterrupt` 转发 INIT/SIPI(忽略 INIT level deassert)。
|
||||
- **实测证据**:Win10 19045 上 8 核两次冷启动、12 核冷启动均验证 x2APIC、FileVault、SSH 与图形登录通过;客体软重启仍由外层 `AF_UNIX` QMP 监控兜底(待进一步观测纯补丁下软重启行为)。
|
||||
|
||||
### PR 3:`whpx: make nested virtualization property failure non-fatal`
|
||||
|
||||
- **补丁文件**:[`patches/qemu-whpx-nested-virt-nonfatal.patch`](../patches/qemu-whpx-nested-virt-nonfatal.patch)(依赖 PR 1 & PR 2)
|
||||
- **影响环境**:部分 Windows 11 宿主(如 24H2 / Home 或 Core Ultra 200 系列)。
|
||||
- **复现与根因**:
|
||||
- `WHvGetCapability` 返回 `Bank1.NestedVirtSupport = 1`,但实际调用 `WHvSetPartitionProperty(WHvPartitionPropertyCodeNestedVirtualization)` 时返回 `hr=0x80370302`(`WHV_E_UNKNOWN_PROPERTY`)。
|
||||
- 上游原代码(`target/i386/whpx/whpx-all.c:3533-3545`)将该错误当作致命错误直接 `goto error` 中止 VM 启动,迫使用户退回 `kernel-irqchip=off`(损失 Hyper-V 内核态 x2APIC / SynIC 加速)。
|
||||
- **最小修复**:
|
||||
- 将 `error_report` + `goto error` 改为 `warn_report` 并将 `processor_features.Bank1.NestedVirtSupport` 清零,继续保留完整 `kernel-irqchip=on` 启动。
|
||||
- **实测状态**:已在 `Reims-Go` 宿主探测逻辑(`internal/host/whpx_probe_windows.go`)复现 `hr=0x80370302`;带该补丁的 `candidate` 运行时需经真机编译冒烟验证后再提上游 PR(**待验证**)。
|
||||
|
||||
---
|
||||
|
||||
## 三、补丁退役检查表
|
||||
|
||||
每当上游合入对应 PR 并产出新 `candidate` 运行时后:
|
||||
1. 移除 `patches/` 下对应 `.patch` 文件,并同步更新 `patches/README.md` 与 `scripts/pack-runtime.ps1`;
|
||||
2. 触发 `.github/workflows/build-runtime.yml` 构建新 `candidate`;
|
||||
3. 在真机运行 `scripts/smoke-runtime.ps1` 并人工确认通过后升级为 `stable`。
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reims-go-frontend",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Cpu, HardDrive, MemoryStick, RefreshCw, ShieldCheck } from 'lucide-react'
|
||||
import React, { useState } from 'react'
|
||||
import { Cpu, Download, HardDrive, MemoryStick, RefreshCw, ShieldCheck } from 'lucide-react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { I18nKey, t } from '../i18n'
|
||||
import { findOptimization, kernelIrqchipHint, optBadgeClass, optStatusLabel } from '../lib/optimizations'
|
||||
import { AppState, Locale, Task } from '../types'
|
||||
import { AppState, AppUpdateInfo, Locale, Task } from '../types'
|
||||
import { Button, IconButton } from '../ui/controls'
|
||||
import { backend } from '../wails'
|
||||
import { RuntimeOnline } from './RuntimeOnline'
|
||||
@@ -22,8 +22,28 @@ interface Props {
|
||||
export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, onSetLocale, runtimeTask, onChannel, onInstallRuntime, onCancelTask }) => {
|
||||
const [importing, setImporting] = useState(false)
|
||||
const [enabling, setEnabling] = useState(false)
|
||||
const [appUpdate, setAppUpdate] = useState<AppUpdateInfo | null>(null)
|
||||
const [checkingUpdate, setCheckingUpdate] = useState(false)
|
||||
const [updateErr, setUpdateErr] = useState('')
|
||||
const { host, config, runtimes, optimizations } = state
|
||||
const tr = (k: I18nKey, v?: Record<string, string | number>) => t(locale, k, v)
|
||||
|
||||
const runUpdateCheck = async (force: boolean) => {
|
||||
setCheckingUpdate(true)
|
||||
setUpdateErr('')
|
||||
try {
|
||||
const info = await backend.checkAppUpdate(force)
|
||||
setAppUpdate(info)
|
||||
} catch (e) {
|
||||
setUpdateErr(String(e).replace(/^Error:\s*/, ''))
|
||||
} finally {
|
||||
setCheckingUpdate(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
void runUpdateCheck(false)
|
||||
}, [])
|
||||
const pcoreOpt = findOptimization(optimizations, 'pcore_pin')
|
||||
const irqOpt = findOptimization(optimizations, 'kernel_irqchip')
|
||||
const rebootOpt = findOptimization(optimizations, 'cold_reboot')
|
||||
@@ -181,6 +201,36 @@ export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, o
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="row-main">
|
||||
<div className="row-title">
|
||||
{tr('appVersionTitle')} <span className="mono">{state.app_version ?? appUpdate?.current ?? 'v0.2.1'}</span>
|
||||
{appUpdate && !appUpdate.has_update && (
|
||||
<span className="badge badge-ok">{tr('appUpToDate')}</span>
|
||||
)}
|
||||
</div>
|
||||
{appUpdate?.has_update ? (
|
||||
<div className="row-sub">{tr('appUpdateAvailable', { v: appUpdate.latest })}</div>
|
||||
) : updateErr ? (
|
||||
<div className="row-sub" title={updateErr}>{tr('appUpdateLookupFailed')}</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="row-right">
|
||||
{appUpdate?.has_update && (appUpdate.page_url || appUpdate.download_url) ? (
|
||||
<Button
|
||||
variant="primary"
|
||||
icon={<Download size={14} />}
|
||||
onClick={() => guard(() => backend.openURL(appUpdate.page_url || appUpdate.download_url || ''))()}
|
||||
>
|
||||
{tr('appDownloadUpdate')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button busy={checkingUpdate} onClick={() => void runUpdateCheck(true)}>
|
||||
{tr('appCheckUpdate')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -237,6 +237,12 @@ const dict = {
|
||||
hostGPUs: '显卡',
|
||||
hostPrefs: '偏好设置',
|
||||
language: '语言',
|
||||
appVersionTitle: '客户端版本',
|
||||
appUpToDate: '已是最新',
|
||||
appUpdateAvailable: '发现新版本 {v}(稳定版)',
|
||||
appCheckUpdate: '检查更新',
|
||||
appDownloadUpdate: '前往下载',
|
||||
appUpdateLookupFailed: '暂时无法连接 GitHub 检查更新',
|
||||
whpxTitle: 'WHPX',
|
||||
whpxReady: '就绪',
|
||||
whpxNoHvShort: '未激活',
|
||||
@@ -617,6 +623,12 @@ const dict = {
|
||||
hostGPUs: 'Graphics cards',
|
||||
hostPrefs: 'Preferences',
|
||||
language: 'Language',
|
||||
appVersionTitle: 'App version',
|
||||
appUpToDate: 'Up to date',
|
||||
appUpdateAvailable: 'New stable release {v} available',
|
||||
appCheckUpdate: 'Check for updates',
|
||||
appDownloadUpdate: 'Download',
|
||||
appUpdateLookupFailed: 'Couldn’t check GitHub for updates',
|
||||
whpxTitle: 'WHPX',
|
||||
whpxReady: 'Ready',
|
||||
whpxNoHvShort: 'Inactive',
|
||||
|
||||
@@ -107,6 +107,18 @@ export interface AppState {
|
||||
pending_changes: Record<string, PendingChange[]>
|
||||
/** First launch: no data folder chosen yet (setup.go). */
|
||||
needs_setup: boolean
|
||||
app_version?: string
|
||||
}
|
||||
|
||||
export interface AppUpdateInfo {
|
||||
current: string
|
||||
latest: string
|
||||
has_update: boolean
|
||||
page_url?: string
|
||||
download_url?: string
|
||||
asset_name?: string
|
||||
asset_size?: number
|
||||
published_at?: string
|
||||
}
|
||||
|
||||
export interface VMDetail {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
AppState,
|
||||
AppUpdateInfo,
|
||||
CachedInstaller,
|
||||
DataRootCheck,
|
||||
DataRootChoice,
|
||||
@@ -66,6 +67,8 @@ declare global {
|
||||
ListRemoteRuntimes(): Promise<RemoteRuntime[] | null>
|
||||
SetRuntimeChannel(channel: string): Promise<void>
|
||||
InstallRuntimeOnline(commit: string): Promise<string>
|
||||
CheckAppUpdate(force: boolean): Promise<AppUpdateInfo>
|
||||
OpenURL(url: string): Promise<void>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,6 +137,8 @@ export const backend = {
|
||||
listRemoteRuntimes: () => app().ListRemoteRuntimes(),
|
||||
setRuntimeChannel: (channel: string) => app().SetRuntimeChannel(channel),
|
||||
installRuntimeOnline: (commit: string) => app().InstallRuntimeOnline(commit),
|
||||
checkAppUpdate: (force = false) => app().CheckAppUpdate(force),
|
||||
openURL: (url: string) => app().OpenURL(url),
|
||||
onTask: (cb: (task: Task) => void) => window.runtime?.EventsOn('reims:task', cb) ?? (() => {}),
|
||||
onStateChanged: (cb: () => void) => window.runtime?.EventsOn('reims:state-changed', cb) ?? (() => {}),
|
||||
onLog: (cb: (entry: LogEntry) => void) => window.runtime?.EventsOn('reims:log', cb) ?? (() => {}),
|
||||
|
||||
Vendored
+5
@@ -1,6 +1,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {reims} from '../models';
|
||||
import {version} from '../models';
|
||||
import {main} from '../models';
|
||||
import {runtime} from '../models';
|
||||
import {installer} from '../models';
|
||||
@@ -13,6 +14,8 @@ export function AttachInstaller(arg1:string,arg2:string):Promise<string>;
|
||||
|
||||
export function CancelTask(arg1:string):Promise<void>;
|
||||
|
||||
export function CheckAppUpdate(arg1:boolean):Promise<version.UpdateInfo>;
|
||||
|
||||
export function CheckDataRoot(arg1:string):Promise<main.DataRootCheck>;
|
||||
|
||||
export function CloneVMCoW(arg1:string,arg2:string):Promise<void>;
|
||||
@@ -61,6 +64,8 @@ export function ListRemoteRuntimes():Promise<Array<runtime.Remote>>;
|
||||
|
||||
export function OpenSharedFolder(arg1:string):Promise<void>;
|
||||
|
||||
export function OpenURL(arg1:string):Promise<void>;
|
||||
|
||||
export function OpenVMFolder(arg1:string):Promise<void>;
|
||||
|
||||
export function PickDirectory(arg1:string):Promise<string>;
|
||||
|
||||
@@ -18,6 +18,10 @@ export function CancelTask(arg1) {
|
||||
return window['go']['main']['App']['CancelTask'](arg1);
|
||||
}
|
||||
|
||||
export function CheckAppUpdate(arg1) {
|
||||
return window['go']['main']['App']['CheckAppUpdate'](arg1);
|
||||
}
|
||||
|
||||
export function CheckDataRoot(arg1) {
|
||||
return window['go']['main']['App']['CheckDataRoot'](arg1);
|
||||
}
|
||||
@@ -114,6 +118,10 @@ export function OpenSharedFolder(arg1) {
|
||||
return window['go']['main']['App']['OpenSharedFolder'](arg1);
|
||||
}
|
||||
|
||||
export function OpenURL(arg1) {
|
||||
return window['go']['main']['App']['OpenURL'](arg1);
|
||||
}
|
||||
|
||||
export function OpenVMFolder(arg1) {
|
||||
return window['go']['main']['App']['OpenVMFolder'](arg1);
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ export namespace main {
|
||||
transitions: Record<string, string>;
|
||||
pending_changes: Record<string, Array<PendingChange>>;
|
||||
needs_setup: boolean;
|
||||
app_version: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AppState(source);
|
||||
@@ -251,6 +252,7 @@ export namespace main {
|
||||
this.transitions = source["transitions"];
|
||||
this.pending_changes = this.convertValues(source["pending_changes"], Array<PendingChange>, true);
|
||||
this.needs_setup = source["needs_setup"];
|
||||
this.app_version = source["app_version"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
@@ -748,3 +750,34 @@ export namespace runtime {
|
||||
|
||||
}
|
||||
|
||||
export namespace version {
|
||||
|
||||
export class UpdateInfo {
|
||||
current: string;
|
||||
latest: string;
|
||||
has_update: boolean;
|
||||
page_url?: string;
|
||||
download_url?: string;
|
||||
asset_name?: string;
|
||||
asset_size?: number;
|
||||
published_at?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new UpdateInfo(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.current = source["current"];
|
||||
this.latest = source["latest"];
|
||||
this.has_update = source["has_update"];
|
||||
this.page_url = source["page_url"];
|
||||
this.download_url = source["download_url"];
|
||||
this.asset_name = source["asset_name"];
|
||||
this.asset_size = source["asset_size"];
|
||||
this.published_at = source["published_at"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Version is the current Reims-Go release version. Release builds may override
|
||||
// it at link time with:
|
||||
//
|
||||
// -ldflags "-X github.com/Nwflower/reims-go/internal/version.Version=v0.2.1"
|
||||
var Version = "v0.2.1"
|
||||
|
||||
const (
|
||||
DefaultReleasesRepo = "Nwflower/Reims-Go"
|
||||
DefaultAPIBase = "https://api.github.com"
|
||||
)
|
||||
|
||||
// Source configures where app releases are checked.
|
||||
type Source struct {
|
||||
APIBase string
|
||||
Repo string
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
func DefaultSource() Source {
|
||||
repo := os.Getenv("REIMS_GO_RELEASES_REPO")
|
||||
if repo == "" {
|
||||
repo = DefaultReleasesRepo
|
||||
}
|
||||
return Source{
|
||||
APIBase: DefaultAPIBase,
|
||||
Repo: repo,
|
||||
Client: &http.Client{},
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateInfo describes the latest stable Reims-Go application release.
|
||||
type UpdateInfo struct {
|
||||
Current string `json:"current"`
|
||||
Latest string `json:"latest"`
|
||||
HasUpdate bool `json:"has_update"`
|
||||
PageURL string `json:"page_url,omitempty"`
|
||||
DownloadURL string `json:"download_url,omitempty"`
|
||||
AssetName string `json:"asset_name,omitempty"`
|
||||
AssetSize int64 `json:"asset_size,omitempty"`
|
||||
PublishedAt string `json:"published_at,omitempty"`
|
||||
}
|
||||
|
||||
type ghRelease struct {
|
||||
TagName string `json:"tag_name"`
|
||||
Draft bool `json:"draft"`
|
||||
Prerelease bool `json:"prerelease"`
|
||||
PublishedAt string `json:"published_at"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Assets []ghAsset `json:"assets"`
|
||||
}
|
||||
|
||||
type ghAsset struct {
|
||||
Name string `json:"name"`
|
||||
Size int64 `json:"size"`
|
||||
URL string `json:"browser_download_url"`
|
||||
}
|
||||
|
||||
// ParseSemver parses a tag like "v0.2.1" or "0.2.1-rc1" into major/minor/patch.
|
||||
func ParseSemver(v string) (major, minor, patch int, ok bool) {
|
||||
s := strings.TrimSpace(v)
|
||||
s = strings.TrimPrefix(s, "v")
|
||||
if idx := strings.IndexAny(s, "-+"); idx >= 0 {
|
||||
s = s[:idx]
|
||||
}
|
||||
parts := strings.Split(s, ".")
|
||||
if len(parts) < 2 || len(parts) > 3 {
|
||||
return 0, 0, 0, false
|
||||
}
|
||||
maj, err1 := strconv.Atoi(parts[0])
|
||||
min, err2 := strconv.Atoi(parts[1])
|
||||
pat := 0
|
||||
var err3 error
|
||||
if len(parts) == 3 {
|
||||
pat, err3 = strconv.Atoi(parts[2])
|
||||
}
|
||||
if err1 != nil || err2 != nil || err3 != nil || maj < 0 || min < 0 || pat < 0 {
|
||||
return 0, 0, 0, false
|
||||
}
|
||||
return maj, min, pat, true
|
||||
}
|
||||
|
||||
// Compare compares two semver strings: returns -1 if a < b, 0 if equal, +1 if a > b.
|
||||
func Compare(a, b string) int {
|
||||
aMaj, aMin, aPat, aOK := ParseSemver(a)
|
||||
bMaj, bMin, bPat, bOK := ParseSemver(b)
|
||||
if !aOK && !bOK {
|
||||
return 0
|
||||
}
|
||||
if !aOK {
|
||||
return -1
|
||||
}
|
||||
if !bOK {
|
||||
return 1
|
||||
}
|
||||
if aMaj != bMaj {
|
||||
if aMaj < bMaj {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
if aMin != bMin {
|
||||
if aMin < bMin {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
if aPat != bPat {
|
||||
if aPat < bPat {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// CheckUpdate queries GitHub Releases for the newest stable (non-draft,
|
||||
// non-prerelease) application release tagged "vX.Y.Z".
|
||||
func (s Source) CheckUpdate(ctx context.Context, current string) (UpdateInfo, error) {
|
||||
if current == "" {
|
||||
current = Version
|
||||
}
|
||||
info := UpdateInfo{Current: current}
|
||||
client := s.Client
|
||||
if client == nil {
|
||||
client = http.DefaultClient
|
||||
}
|
||||
url := fmt.Sprintf("%s/repos/%s/releases?per_page=30", strings.TrimRight(s.APIBase, "/"), s.Repo)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return info, err
|
||||
}
|
||||
req.Header.Set("User-Agent", "reims-go")
|
||||
req.Header.Set("Accept", "application/vnd.github+json")
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return info, fmt.Errorf("check app updates: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusTooManyRequests {
|
||||
return info, fmt.Errorf("GitHub API rate limit reached; try again later (HTTP %d)", resp.StatusCode)
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return info, fmt.Errorf("check app updates: HTTP %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
var rels []ghRelease
|
||||
if err := json.NewDecoder(resp.Body).Decode(&rels); err != nil {
|
||||
return info, fmt.Errorf("read app releases: %w", err)
|
||||
}
|
||||
|
||||
var best *ghRelease
|
||||
for i := range rels {
|
||||
r := &rels[i]
|
||||
if r.Draft || r.Prerelease || !strings.HasPrefix(r.TagName, "v") {
|
||||
continue
|
||||
}
|
||||
if _, _, _, ok := ParseSemver(r.TagName); !ok {
|
||||
continue
|
||||
}
|
||||
if best == nil || Compare(r.TagName, best.TagName) > 0 {
|
||||
best = r
|
||||
}
|
||||
}
|
||||
if best == nil {
|
||||
info.Latest = current
|
||||
return info, nil
|
||||
}
|
||||
|
||||
info.Latest = best.TagName
|
||||
info.PageURL = best.HTMLURL
|
||||
info.PublishedAt = best.PublishedAt
|
||||
for _, a := range best.Assets {
|
||||
lower := strings.ToLower(a.Name)
|
||||
if strings.HasSuffix(lower, ".exe") && !strings.Contains(lower, "-cli-") {
|
||||
info.AssetName = a.Name
|
||||
info.AssetSize = a.Size
|
||||
info.DownloadURL = a.URL
|
||||
break
|
||||
}
|
||||
}
|
||||
info.HasUpdate = Compare(current, best.TagName) < 0
|
||||
return info, nil
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCompare(t *testing.T) {
|
||||
cases := []struct {
|
||||
a, b string
|
||||
want int
|
||||
}{
|
||||
{"v0.2.0", "v0.2.1", -1},
|
||||
{"v0.2.1", "v0.2.1", 0},
|
||||
{"v0.10.0", "v0.2.9", 1},
|
||||
{"v1.0.0", "v0.9.9", 1},
|
||||
{"dev", "v0.2.1", -1},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
if got := Compare(tc.a, tc.b); got != tc.want {
|
||||
t.Errorf("Compare(%q, %q) = %d, want %d", tc.a, tc.b, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckUpdateFindsNewerStableOnly(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte(`[
|
||||
{"tag_name":"runtime-3731afd","draft":false,"prerelease":false,"html_url":"https://example.test/rt","assets":[]},
|
||||
{"tag_name":"v0.3.0-rc1","draft":false,"prerelease":true,"html_url":"https://example.test/rc","assets":[]},
|
||||
{"tag_name":"v0.4.0","draft":true,"prerelease":false,"html_url":"https://example.test/draft","assets":[]},
|
||||
{"tag_name":"v0.2.0","draft":false,"prerelease":false,"html_url":"https://example.test/v0.2.0","assets":[]},
|
||||
{
|
||||
"tag_name":"v0.2.2",
|
||||
"draft":false,
|
||||
"prerelease":false,
|
||||
"published_at":"2026-11-29T00:00:00Z",
|
||||
"html_url":"https://github.com/Nwflower/Reims-Go/releases/tag/v0.2.2",
|
||||
"assets":[
|
||||
{"name":"reims-go-cli-v0.2.2-windows-amd64.exe","size":11000000,"browser_download_url":"https://example.test/cli.exe"},
|
||||
{"name":"reims-go-v0.2.2-windows-amd64.exe","size":14000000,"browser_download_url":"https://example.test/gui.exe"}
|
||||
]
|
||||
}
|
||||
]`))
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
src := Source{APIBase: srv.URL, Repo: "Nwflower/Reims-Go", Client: srv.Client()}
|
||||
info, err := src.CheckUpdate(context.Background(), "v0.2.1")
|
||||
if err != nil {
|
||||
t.Fatalf("CheckUpdate: %v", err)
|
||||
}
|
||||
if !info.HasUpdate {
|
||||
t.Fatalf("expected HasUpdate=true, got %+v", info)
|
||||
}
|
||||
if info.Latest != "v0.2.2" {
|
||||
t.Fatalf("Latest = %q, want v0.2.2", info.Latest)
|
||||
}
|
||||
if info.AssetName != "reims-go-v0.2.2-windows-amd64.exe" || info.DownloadURL != "https://example.test/gui.exe" {
|
||||
t.Fatalf("unexpected asset: %+v", info)
|
||||
}
|
||||
|
||||
// Same version reports up to date.
|
||||
upToDate, err := src.CheckUpdate(context.Background(), "v0.2.2")
|
||||
if err != nil {
|
||||
t.Fatalf("CheckUpdate(same): %v", err)
|
||||
}
|
||||
if upToDate.HasUpdate {
|
||||
t.Fatalf("expected HasUpdate=false when already on latest: %+v", upToDate)
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/Nwflower/reims-go/internal/config"
|
||||
"github.com/Nwflower/reims-go/internal/installer"
|
||||
rt "github.com/Nwflower/reims-go/internal/runtime"
|
||||
"github.com/Nwflower/reims-go/internal/version"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -178,3 +179,40 @@ func percent(done, total int64) float64 {
|
||||
}
|
||||
return float64(done) * 100 / float64(total)
|
||||
}
|
||||
|
||||
var appUpdateCache struct {
|
||||
sync.Mutex
|
||||
at time.Time
|
||||
info *version.UpdateInfo
|
||||
}
|
||||
|
||||
// CheckAppUpdate checks GitHub Releases for a newer stable Reims-Go version.
|
||||
// Results are cached for 10 minutes unless force is true.
|
||||
func (a *App) CheckAppUpdate(force bool) (version.UpdateInfo, error) {
|
||||
appUpdateCache.Lock()
|
||||
defer appUpdateCache.Unlock()
|
||||
if !force && appUpdateCache.info != nil && time.Since(appUpdateCache.at) < remoteCacheTTL {
|
||||
return *appUpdateCache.info, nil
|
||||
}
|
||||
info, err := version.DefaultSource().CheckUpdate(a.baseCtx(), version.Version)
|
||||
if err != nil {
|
||||
return info, err
|
||||
}
|
||||
copyInfo := info
|
||||
appUpdateCache.at = time.Now()
|
||||
appUpdateCache.info = ©Info
|
||||
return info, nil
|
||||
}
|
||||
|
||||
// OpenURL opens an HTTPS link in the host's default browser.
|
||||
func (a *App) OpenURL(raw string) error {
|
||||
trimmed := strings.TrimSpace(raw)
|
||||
if !strings.HasPrefix(trimmed, "https://") {
|
||||
return fmt.Errorf("refusing to open non-HTTPS URL")
|
||||
}
|
||||
if a.ctx == nil {
|
||||
return errors.New("window context not ready")
|
||||
}
|
||||
wailsRuntime.BrowserOpenURL(a.ctx, trimmed)
|
||||
return nil
|
||||
}
|
||||
+56
-12
@@ -36,7 +36,8 @@ param(
|
||||
[string]$TempRoot = 'D:\Build\Temp',
|
||||
[ValidateSet('candidate', 'stable')]
|
||||
[string]$Channel = 'candidate',
|
||||
[int]$ZstdLevel = 15
|
||||
[int]$ZstdLevel = 15,
|
||||
[switch]$IncludeNestedVirtPatch
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -102,23 +103,66 @@ $utilVersionLine = (& $utilExe --version | Select-Object -First 1).Trim()
|
||||
|
||||
# ── 2. Patches must equal the build tree's diffs ─────────────
|
||||
$patchSpecs = @(
|
||||
@{ Name = 'reims-vgpu-cargo-lock.patch'; Target = 'reims-vgpu'; Repo = $ReimsRepo; Paths = @('Cargo.lock') },
|
||||
@{ Name = 'qemu-whpx-win10-compat.patch'; Target = 'vendor/qemu'; Repo = $qemuRepo; Paths = @() },
|
||||
@{ Name = 'qemu-whpx-win10-startup-ipis.patch'; Target = 'vendor/qemu'; Repo = $qemuRepo; Paths = @() }
|
||||
@{ Name = 'reims-vgpu-cargo-lock.patch'; Target = 'reims-vgpu'; Repo = $ReimsRepo; Paths = @('Cargo.lock') },
|
||||
@{ Name = 'qemu-whpx-win10-compat.patch'; Target = 'vendor/qemu'; Repo = $qemuRepo; Paths = @() },
|
||||
@{ Name = 'qemu-whpx-win10-startup-ipis.patch'; Target = 'vendor/qemu'; Repo = $qemuRepo; Paths = @() }
|
||||
)
|
||||
if ($IncludeNestedVirtPatch) {
|
||||
$patchSpecs += @{ Name = 'qemu-whpx-nested-virt-nonfatal.patch'; Target = 'vendor/qemu'; Repo = $qemuRepo; Paths = @() }
|
||||
}
|
||||
$patches = @()
|
||||
# Group patches by repo so multi-patch stacks (e.g. 2-3 QEMU WHPX patches) are
|
||||
# verified together against a clean HEAD export with zero undeclared diff.
|
||||
$byTarget = [ordered]@{}
|
||||
foreach ($ps in $patchSpecs) {
|
||||
$file = Join-Path $patchesDir $ps.Name
|
||||
if (-not (Test-Path -LiteralPath $file)) { throw "Patch missing: $file" }
|
||||
$argv = @('-C', $ps.Repo, '-c', 'core.autocrlf=false', 'diff')
|
||||
if ($ps.Paths.Count) { $argv += $ps.Paths }
|
||||
$treeDiff = (& git @argv | Out-String).Replace("`r`n", "`n")
|
||||
$patchText = [IO.File]::ReadAllText($file).Replace("`r`n", "`n")
|
||||
if ($treeDiff.TrimEnd() -ne $patchText.TrimEnd()) {
|
||||
throw "$($ps.Name) does not match the build tree's diff in $($ps.Repo). Stop: don't edit patches automatically (AGENTS.md rule 4)."
|
||||
if (-not $byTarget.Contains($ps.Target)) {
|
||||
$byTarget[$ps.Target] = [Collections.Generic.List[hashtable]]::new()
|
||||
}
|
||||
$byTarget[$ps.Target].Add($ps)
|
||||
$patches += [ordered]@{ name = $ps.Name; target = $ps.Target; sha256 = (Get-Sha256 $file) }
|
||||
}
|
||||
foreach ($targetName in $byTarget.Keys) {
|
||||
$group = $byTarget[$targetName]
|
||||
$repo = $group[0].Repo
|
||||
$paths = @($group | ForEach-Object { $_.Paths } | Where-Object { $_ } | Select-Object -Unique)
|
||||
$diffArgs = @('-C', $repo, '-c', 'core.autocrlf=false', 'diff')
|
||||
if ($paths.Count) { $diffArgs += $paths }
|
||||
$treeDiff = (& git @diffArgs | Out-String).Replace("`r`n", "`n").TrimEnd()
|
||||
|
||||
if ($group.Count -eq 1) {
|
||||
$patchText = [IO.File]::ReadAllText((Join-Path $patchesDir $group[0].Name)).Replace("`r`n", "`n").TrimEnd()
|
||||
if ($treeDiff -ne $patchText) {
|
||||
throw "$($group[0].Name) does not match the build tree's diff in $repo. Stop: don't edit patches automatically (AGENTS.md rule 4)."
|
||||
}
|
||||
} else {
|
||||
# Apply the declared patch stack to a clean temporary clone of HEAD and compare diffs byte-for-byte.
|
||||
$verifyDir = Join-Path $TempRoot ("patch-verify-" + [guid]::NewGuid())
|
||||
try {
|
||||
New-Item -ItemType Directory -Force -Path $verifyDir | Out-Null
|
||||
$headRev = (git -C $repo rev-parse HEAD).Trim()
|
||||
Invoke-Native 'git' @('init', '-q', $verifyDir)
|
||||
$tar = Join-Path $TempRoot ("patch-verify-" + [guid]::NewGuid() + '.tar')
|
||||
Invoke-Native 'git' @('-C', $repo, 'archive', '--format=tar', '-o', $tar, $headRev)
|
||||
Invoke-Native 'tar.exe' @('-xf', $tar, '-C', $verifyDir)
|
||||
Remove-Item -LiteralPath $tar -Force
|
||||
Invoke-Native 'git' @('-C', $verifyDir, '-c', 'user.name=verify', '-c', 'user.email=verify@local', 'add', '-A')
|
||||
Invoke-Native 'git' @('-C', $verifyDir, '-c', 'user.name=verify', '-c', 'user.email=verify@local', 'commit', '-q', '-m', 'base')
|
||||
foreach ($ps in $group) {
|
||||
$pf = Join-Path $patchesDir $ps.Name
|
||||
Invoke-Native 'git' @('-C', $verifyDir, 'apply', '--check', $pf)
|
||||
Invoke-Native 'git' @('-C', $verifyDir, 'apply', $pf)
|
||||
}
|
||||
$expectedDiff = (& git -C $verifyDir -c core.autocrlf=false diff | Out-String).Replace("`r`n", "`n").TrimEnd()
|
||||
if ($treeDiff -ne $expectedDiff) {
|
||||
throw "Patch stack ($(($group | ForEach-Object { $_.Name }) -join ', ')) does not match the build tree's diff in $repo. Stop: don't edit patches automatically (AGENTS.md rule 4)."
|
||||
}
|
||||
} finally {
|
||||
if (Test-Path -LiteralPath $verifyDir) { Remove-Item -Recurse -Force -LiteralPath $verifyDir }
|
||||
}
|
||||
}
|
||||
}
|
||||
# Anything else changed in the build trees is undeclared: refuse.
|
||||
$otherCtl = @(git -C $ReimsRepo status --porcelain --ignore-submodules=all | Where-Object { $_ -notmatch 'Cargo\.lock$' })
|
||||
$otherQemu = @(git -C $qemuRepo status --porcelain --untracked-files=no | Where-Object { $_ -notmatch 'target/i386/whpx/whpx-all\.c$' })
|
||||
@@ -236,8 +280,8 @@ The trees are pristine upstream. The binaries were built after applying the
|
||||
patches in ``patches/``:
|
||||
|
||||
cd reims-vgpu-$commit && git apply ../patches/reims-vgpu-cargo-lock.patch
|
||||
cd vendor/qemu && git apply ../../../patches/qemu-whpx-win10-compat.patch
|
||||
git apply ../../../patches/qemu-whpx-win10-startup-ipis.patch
|
||||
cd vendor/qemu
|
||||
$((($patchSpecs | Where-Object { $_.Target -eq 'vendor/qemu' } | ForEach-Object { " git apply ../../../patches/$($_.Name)" }) -join "`n"))
|
||||
|
||||
(``patch -p1`` works too.) Then build as upstream documents (``scripts/install-ctl.sh``
|
||||
in an MSYS2 CLANG64 shell). The DLLs in ``qemu/bin`` come from the MSYS2
|
||||
|
||||
Reference in new issue
Block a user