1 Commits
Author SHA1 Message Date
yetone cd25b37358 update: a Scoop or winget magpie leaves updating to them
tziyi1998 on X asked for Scoop and winget. magpie-releases now carries a
Scoop bucket and winget manifests beside the Homebrew tap; a magpie they
installed has to leave updating to them, as a Homebrew one does, or
their next update puts back the version they hold.

PackagedBy now knows Windows: Scoop's apps\<name>\<version> (or its
current junction) with the scoop-install.json and scoop-manifest.json it
writes there (install.json and manifest.json before Scoop 0.6), and
winget's WinGet\Packages\<id>_<source> (_Microsoft.Winget.Source_… from
the community repository, __DefaultSource from a local manifest). Name
and Command give "Scoop" / `scoop update <name>` and `winget upgrade --id
<id>`; the CLI, serve and the GUI already say p.Say() for a packaged
binary, and the GUI's existing string carries it in every language.

update.Executable failed on Scoop's junction: Go's EvalSymlinks says "The
system cannot find the path specified" there, so the packaged check was
skipped and `magpie update` failed with that error. It now keeps the
path the binary was started from when the links can't be resolved, as
shortcut, autostart, appdir and daemon already do.

Run, at 23c03c6ee (this change rebased on b400566f9):
- xiaomi-gpu (Windows 11, Go 1.26.8): go test ./internal/update/: all
  new tests pass; TestPackagedByDpkg red, the same on main (#4603).
  TestScoopJunctionStillPackaged makes a real junction with mklink /J.
  go vet ./internal/update/ ./internal/cli/ ./internal/gui/ ok;
  GOOS=linux and GOOS=darwin go vet -tags nogui of update and cli ok.
- Broken by hand: resolved() returning "" on failure (the old error)
  turns TestScoopJunctionStillPackaged and
  TestResolvedKeepsUnresolvablePath red.
- Real Scoop 0.6.0 in a sandbox -ScoopDir with the bucket from
  magpie-releases: this branch's CLI (as 0.1.4477) in apps\magpie\current
  says "this magpie was installed with Scoop (package magpie), which
  updates it, not magpie: scoop update magpie" and leaves the file
  unchanged; the same binary in a plain folder still offers the update.
- Real winget 1.29, winget install --manifest yetone.Magpie.CLI: the
  binary in its package folder says "installed with winget … winget
  upgrade magpie" (the folder was __DefaultSource, now read as the id
  too). Uninstalled; LocalManifestFiles turned back off.
- mote (macOS): gofmt; go test ./internal/update/ ok; ./internal/cli/
  red in TestHealthcheckFindsTheRunningGatewayWithoutMagpieAddr,
  TestUpdateRestartsTheGatewayItFindsWithoutMagpieAddr and
  TestUpdateFindsAMagpieThatWroteNoRecord, red the same at origin/main
  f1e2ada0f on mote and on Windows (open issues, e.g. #6223). Windows
  also has TestLibraryProjectCmd red on main (#7119, filed now).
Not run: the full ./... suite. mote was at load 28 with another
session's full and GUI suites, WSL at load 50 with a GUI suite, and
mica ran out of disk partway (its run tested nothing).
Not tried: the GUI app under Scoop or winget, arm64.
2026-11-18 23:33:19 +08:00