Skip to content

fix(godot-cpp): repack.sh for 10.0.0-stable's multi-API layout (+2 reproducibility bugs) - #537

Open
FarnaHerry wants to merge 1 commit into
mcpplibs:mainfrom
FarnaHerry:feat/godot-cpp-10.0.0-stable
Open

FarnaHerry wants to merge 1 commit into
mcpplibs:mainfrom
FarnaHerry:feat/godot-cpp-10.0.0-stable

Conversation

@FarnaHerry

Copy link
Copy Markdown
Collaborator

What

tools/godot-cpp/repack.sh cannot build godot-cpp 10.0.0-stable at all, and two of its steps are not reproducible off the machine that produced the current archives. Three fixes, one script.

1. The tag is multi-API now

10.0.0-stable (2026-09-15) dropped the single gdextension/extension_api.json and ships one per engine minor — extension_api-4-3.json … extension_api-4-7.json — and the build picks one. Upstream's own three entry points all say 4.7 for this release: scons api_version= (Makefile, test/SConstruct), cmake GODOTCPP_DEFAULT_API_VERSION (CMakeLists.txt), tools/godotcpp.py::supported_api_versions (4.3 … 4.7). The script hardcoded the single-API path, so it dies with FileNotFoundError on this tag.

It now resolves the file the way the tag itself declares: explicit ENGINE_API argument > the tag's GODOTCPP_DEFAULT_API_VERSION > highest present. Single-API tags short-circuit on the file existing, so nothing changes for them. The generator entry point is unchanged (generate_bindings; with no build profile it is upstream's scons path — generate_trimmed_api("") returns the api as-is and generate_template_get_node defaults to True).

index version upstream tag engine
4.5.0 godot-4.5-stable Godot 4.5
10.0.0-rc1 10.0.0-rc1 Godot 4.6
10.0.0-stable 10.0.0-stable Godot 4.7

2. The "upstream untouched" check was locale-dependent

It filters diff's Only in <dir>: gen line. On a zh_CN host that line is 只在 <dir> 中存在:gen, so nothing matches and every archive is refused as "upstream files were modified", regardless of content. Now LC_ALL=C diff — pin the message language instead of matching a translation.

3. The archive sha256 depended on the packer's umask

gen/ is created during the repack, so its mode bits (dirs 0o777&~umask, files 0o666&~umask) ride into the archive: umask 002 → 775/664, umask 022 → 755/644. Identical content, different sha256. Non-root extraction of the upstream tarball has the same issue (GitHub's tarballs carry 775/664, extraction under umask 022 yields 755/644), so tar -xzpf takes upstream's modes and umask 002 is pinned for the generated tree. No published byte changes — the two existing archives are the 002 spelling.

Verification (both published hashes reproduce exactly)

tools/godot-cpp/repack.sh godot-4.5-stable 4.5.0         /tmp/out
tools/godot-cpp/repack.sh 10.0.0-rc1       10.0.0-rc1     /tmp/out
tools/godot-cpp/repack.sh 10.0.0-stable    10.0.0-stable /tmp/out
tools/godot-cpp/repack.sh 10.0.0-stable    10.0.0-stable /tmp/out2   # determinism
tag sha256 vs the index entry
godot-4.5-stable b0c36e77f02c4181352cdd7547b209b93a833be1ad6197f8c650d92987221a00 identical (unchanged bytes)
10.0.0-rc1 aaafbf50d4b8469d610fdb2eb76c6f58d758dbabbc6b013f60464d99b20ceb6e identical (unchanged bytes)
10.0.0-stable 66aaafb642e7a390482dc381818640b1d0e583da2ef0cc9709214bcd13b68264 new, identical across two runs

The new archive was checked from the inside: gen/include/godot_cpp/core/version.hpp = 4.7.0 stable, gdextension/extension_api-4-7.json header = Godot Engine v4.7.stable.official, 1052 generated class headers (vs ~1022 TUs for rc1), and every upstream file byte-identical (gen/ the only addition).

Design notes: .agents/docs/2026-10-17-add-godot-cpp-10.0.0-stable-plan.md.

Deliberately not in this PR (needs org write access)

The 10.0.0-stable version entries can only land once the artifact is downloadable, because CI installs it:

  1. publish godot-cpp-10.0.0-stable.tar.gz (sha256 66aaafb6…) to xlings-res/godot-cpp and the gitcode mcpp-res mirror under tag 10.0.0-stable;
  2. a v10.0.0-stable tag in mcpplibs/godot-cpp-m (version + compat.godot-cpp dependency bump, hashfuncs.hpp shim re-checked against the 4.7 headers);
  3. then the two pkgs/*.lua entries, the tests/examples/ member and the README rows.

I have no write access to either artifact repo, so 3 is a small mechanical change I'm happy to push the moment 1 and 2 are up (URLs + sha256 are known) — or leave it to you if you'd rather do the whole registration yourself, the way 10.0.0-rc1 was done.

…reproducibility bugs)

10.0.0-stable no longer ships a single gdextension/extension_api.json: one tag
carries extension_api-4-3..4-7.json and the build picks one (scons
api_version=, cmake GODOTCPP_DEFAULT_API_VERSION -- both say 4.7 for this
release). The script hardcoded the single-API path and cannot build the tag.

- resolve the API json the way the tag itself declares: explicit ENGINE_API >
  CMakeLists' GODOTCPP_DEFAULT_API_VERSION > highest present; single-API tags
  short-circuit on the file existing, so 4.5.0 / 10.0.0-rc1 stay byte-identical
- LC_ALL=C on the "upstream tree untouched" check: it matches diff's
  "Only in <dir>: gen" line, which is localized -- on a zh_CN host it reads
  "只在 <dir> 中存在:gen", matches nothing, and every archive is refused
- umask 002 + tar -xzpf: gen/ is created at repack time, so its mode bits come
  from the packer's umask and ride into the archive (002 -> 775/664,
  022 -> 755/644). Same content, different sha256 per host; the two published
  archives are the 002 spelling.

Verified (both published sha256s reproduce exactly; 4.7 is new + deterministic):
  4.5.0          b0c36e77... = the index entry
  10.0.0-rc1     aaafbf50... = the index entry
  10.0.0-stable  66aaafb6... (x2), gen version.hpp = 4.7.0 stable

The 10.0.0-stable version entry / example member / README rows are deliberately
NOT here: they need the repacked archive published to xlings-res/godot-cpp (and
the gitcode mirror) plus a v10.0.0-stable tag in mcpplibs/godot-cpp-m, neither of
which an outside contributor can do. Hashes + follow-up checklist:
.agents/docs/2026-10-17-add-godot-cpp-10.0.0-stable-plan.md
@FarnaHerry

Copy link
Copy Markdown
Collaborator Author

@Sunrisepeak

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant