Bring the snap packaging up to a base that can compile it - #35
Merged
Conversation
The snapcraft.yaml had not been touched since 2021 and could not have built anything since the move to C++20. core18 is Ubuntu 18.04, whose g++ is 7; the part also still described a make build, from before the interpreter was built with CMake, and claimed version 2.0. core24 brings g++ 13. The part is now the cmake plugin pointed at src/, which already has an install() rule, so the binary stages without help. The version is read out of main.cc at pull time via adopt-info rather than repeated here, which is how the old file came to sit five years behind. Moved back to snap/snapcraft.yaml. Snapcraft looks in snapcraft.yaml, snap/, build-aux/snap/ and .snapcraft.yaml, and nowhere else -- so the move to drivers/snap/ in e22fc85, collateral from an unrelated restructure, left the file somewhere the tool would never find. Four years unbuildable for two separate reasons is enough. Strict confinement now names the interfaces it actually needs. A game is a file the player names on the command line and a save is written next to it, which is the 'home' plug; 'removable-media' is there for anyone keeping games on a stick, and needs connecting by hand. The three games from the browser build ship compiled, along with the library sources an author's own game includes. Compiling a game means running an interpreter, so that part waits for the native one to stage -- which also makes it the step that cannot be cross-compiled. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019g4fqvhoV5MtLJJXM7uFLZ
Nothing else in this repository proves the packaging works, and snapcraft does not run on the machine the interpreter is developed on, so until now the only way to find out was to publish and hear about it. Building proves it packages. Installing the result and playing a turn proves the binary runs under confinement and that the bundled games are where the snap's own description promises they are -- which is the part most likely to rot, since it is prose about paths. Restricted to changes under snap/, plus workflow_dispatch. A snap build compiles the whole interpreter in an LXD container, minutes against the seconds CI takes, and a C++ change that will not compile has already failed in CI before it could fail here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019g4fqvhoV5MtLJJXM7uFLZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The snap packaging had not been touched since January 2021 and could not have
built the current interpreter for two independent reasons.
It was in a place snapcraft does not look. Snapcraft searches exactly four
paths —
snapcraft.yaml,snap/snapcraft.yaml,build-aux/snap/snapcraft.yaml,.snapcraft.yaml. The file was moved fromsnap/todrivers/snap/in e22fc85(2022-04-07), collateral from an unrelated Boost/GCP restructure, and has been
undiscoverable ever since. Moved back.
Its base predates the language the interpreter is written in.
core18isUbuntu 18.04, whose g++ is 7 — nowhere near C++20.
core24brings g++ 13. Thepart also still described a
makebuild from before the move to CMake, anddeclared
version: '2.0'against an interpreter that reports 3.0.What the rewritten file does:
plugin: cmakewithsource-subdir: src, where theCMakeLists.txtlives.src/CMakeLists.txtalready has aninstall()rule, so the binary stageswithout an
override-build.adopt-inforeads the version out ofsrc/main.ccat pull time rather thanrepeating it, which is how the old file came to sit five years behind.
on the command line and a save is written next to it, which is the
homeplug(auto-connected from the store).
removable-mediais there for games kept on astick and needs
snap connectby hand. Classic confinement would have meantmanual store review for no benefit.
sources —
standard.archand friends — so an author's own game caninclude "standard"by pointing--includeat$SNAP/usr/share/archetype/games.Compiling a game means running an interpreter, so that part is
after:thenative one, which also makes it the step that cannot be cross-compiled.
The second commit adds a CI job, because snapcraft does not run on macOS and
there was otherwise no way to learn the packaging was broken short of publishing
it. It builds the snap, installs it, and plays a turn of The Gorreven Papers out
of the bundled
.acx— the install-and-play half is what checks that the pathspromised in the snap's own description are real. It runs only on changes under
snap/, plusworkflow_dispatch; a snap build is minutes in an LXD container,and a C++ change that will not compile has already failed in CI.
Test plan
Verified locally on macOS as far as macOS allows — snapcraft itself is Linux-only,
so the CI job on this PR is the real test:
adopt-infoextraction returns3.0against the realsrc/main.cc.override-buildrun by hand against./build/archetype:gorreven 69,784 bytes, starship 55,703, animal 1,108.
archetype --perform=…/gorreven.acx, plays a turn.Not done here
snapcore/action-publishand aSNAPCRAFT_STORE_CREDENTIALSsecret, and thearchetypename registered in thestore. Worth a follow-up once this builds green.
--includeergonomics. The interpreter reads no environment variable, so abundled game means typing
$SNAP/usr/share/archetype/games. Teachingmain.ccto honour something like
ARCHETYPE_INCLUDEwould let the snap set it inapps.archetype.environmentand make the whole thing a one-word command.🤖 Generated with Claude Code
https://claude.ai/code/session_019g4fqvhoV5MtLJJXM7uFLZ