Files
moonwell-client-core/scripts/sync-reference.py
T
sindoring d1961e79fc Sync upstream through b2473e60 and retain ruRU (#8)
Integrate 182 upstream commits through b2473e60 while retaining MoonWell packaging, branding and the community ruRU pack.

Upstream replaces the C Lua/mlua host with benilla-lua/benilla-mlua and the native glue screens with stock GlueXML. The update also includes the new locale/DBC/name rules, cache and interaction handling, rendering, quest log and chat behavior, including the latest quest completion and timed-quest failure fixes. Fork adaptations use the new APIs: stock Wow.ini locales remain intact, while the ruRU overlay reads column zero and retains its ruRU authentication tag and Lua identity. Russian names keep their twelve-letter policy and Unicode roster matching; fonts, spell costs, race/class labels and translated options retain real-pack regression coverage.

Windows regression fixes keep the locale-default test valid under instrumented window overrides and the shader assertion independent of checkout line endings. The original C Lua 5.1 host, rebuilt from c0630f3d in an isolated directory, reproduces the complete Windows cos-sweep answer byte for byte; cos now uses platform-specific goldens.

Validation on Windows: scripts/gates.sh passed all automatic gates, including real-data and no-install workspace tests, reference tables, documentation, message catalog, render-pass lint, player clippy/tests and engine boots with and without data. MoonWell player clippy also passed with -D warnings. The committed tree exactly matches the full green stamp; five vendored Kira files retain the tested checkout's line endings, with normalized contents unchanged. All three actual ruRU pack regressions passed in both builds. Fifteen test archives were restored read-only from the published client and SHA-256 checked.

Each real-data/player rung skipped 31 tests because the optional addon corpus is absent (24 general, 7 Quiver). Live smoke was not run: no declared probe account; no player-account login or character creation was performed. Linux/macOS changes were not locally built.
2026-10-17 21:10:31 +03:00

87 lines
3.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Vendor benilla-re's tables into `reference/` at the commit `reference/PIN` names.
scripts/sync-reference.py <benilla-re checkout> copy the tables at the PIN
scripts/sync-reference.py <benilla-re checkout> --check fail when a copy differs
Each file is `git show <PIN>:tables/<name>` byte for byte. To update, put a new 40-hex commit of
benilla-re in `reference/PIN` and run the script without `--check`.
"""
import os
import subprocess
import sys
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
REFERENCE = os.path.join(REPO, "reference")
# The benilla-re tables benilla reads.
TABLES = [
"bindings.tsv",
"chat_groups.tsv",
"chat_types.tsv",
"cvars.tsv",
"event_args.tsv",
"events.tsv",
"glue_events.tsv",
"glue_surface.tsv",
"lua_globals.tsv",
"messages.tsv",
"verb_events.tsv",
]
def git_show(checkout, pin, name):
r = subprocess.run(
["git", "-C", checkout, "show", f"{pin}:tables/{name}"], capture_output=True
)
if r.returncode != 0:
sys.exit(f"sync-reference: {pin[:12]}:tables/{name} not in {checkout}: {r.stderr.decode().strip()}")
return r.stdout
def main():
args = [a for a in sys.argv[1:] if a != "--check"]
check = "--check" in sys.argv[1:]
if len(args) != 1:
sys.exit("usage: scripts/sync-reference.py <benilla-re checkout> [--check]")
checkout = args[0]
with open(os.path.join(REFERENCE, "PIN")) as f:
pin = f.read().strip()
if len(pin) != 40 or any(c not in "0123456789abcdef" for c in pin):
sys.exit("sync-reference: reference/PIN must hold a full 40-hex commit")
for ref in ("origin/main", "main"):
r = subprocess.run(["git", "-C", checkout, "merge-base", "--is-ancestor", pin, ref],
capture_output=True)
if r.returncode in (0, 1):
if r.returncode == 1:
sys.exit(f"sync-reference: the PIN {pin[:12]} is not on benilla-re's {ref}")
break
stray = sorted(n for n in os.listdir(REFERENCE) if n.endswith(".tsv") and n not in TABLES)
if stray:
sys.exit("sync-reference: reference/ holds tables it does not vendor: " + ", ".join(stray))
bad = []
for name in TABLES:
want = git_show(checkout, pin, name)
path = os.path.join(REFERENCE, name)
have = open(path, "rb").read() if os.path.exists(path) else None
if have == want:
continue
if check:
bad.append(name)
else:
with open(path, "wb") as f:
f.write(want)
print(f"sync-reference: wrote reference/{name}")
if bad:
sys.exit(
"sync-reference: differs from benilla-re at the PIN: "
+ ", ".join(bad)
+ " (run scripts/sync-reference.py <benilla-re checkout>)"
)
if check:
print(f"sync-reference: {len(TABLES)} tables match benilla-re at {pin[:12]}")
if __name__ == "__main__":
main()