Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Sync: regenerate the generated docs indexes (game-patches, symptoms) on every sync

LNPANDYc7eca13be3f4
diff --git a/scripts/sync_upstream.py b/scripts/sync_upstream.py
index 237b218d..3f04908b 100644
--- a/scripts/sync_upstream.py
+++ b/scripts/sync_upstream.py
@@ -1741,6 +1741,10 @@ DROPPED = {
# them since 4d2dc7db (#385, same function names, same behaviour), so the sync takes upstream's files again.
'dm/host/hle_time.c': 'the fork-only parts landed upstream as 4d2dc7db (#385)',
'dm/host/tests/t_time.c': 'the fork-only parts landed upstream as 4d2dc7db (#385)',
+ # Generated by dm/tools/docs_patches.py from the fork's own patches/profiles/host tables
+ # (refresh_generated_indexes regenerates it on every sync); upstream's copy describes upstream's.
+ 'docs/agents/game-patches.md': 'generated: docs_patches.py over the fork tree (refreshed by the sync)',
+ 'docs/agents/symptoms.md': 'generated: docs_symptoms.py over docs/reference (refreshed by the sync)',
}
# The picked-location part of the fixture (the Files-app pick): the stub, argv[4], and the test.
@@ -2237,6 +2241,26 @@ def refresh_game_table_zh():
f'({", ".join(t for t, _, _ in missing)}) — names are English until translated')
+def refresh_generated_indexes():
+ """Regenerate the indexes upstream's own tests require to be current, from the fork's tree.
+
+ docs/agents/game-patches.md is dm/tools/docs_patches.py's output over the patch files, host
+ tables and profiles — all of which differ in the fork from upstream, so the synced copy would
+ fail test_docs.test_index_is_current. docs/agents/symptoms.md is docs_symptoms.py's output over
+ docs/reference (vendored, but the same rule). Both are generated; running their tools here keeps
+ the tree consistent no matter what upstream's copy says (their DROPPED entries explain why the
+ protection check accepts the difference).
+ """
+ for tool, out in (('docs_patches.py', 'docs/agents/game-patches.md'),
+ ('docs_symptoms.py', 'docs/agents/symptoms.md')):
+ r = subprocess.run([sys.executable, str(REPO / 'dm/tools' / tool)], cwd=REPO,
+ capture_output=True, text=True)
+ if r.returncode != 0:
+ say(f' ! {tool} failed: {r.stderr.strip().splitlines()[-1] if r.stderr.strip() else r.returncode}')
+ else:
+ say(f' = {out} regenerated')
+
+
def refresh_badges():
"""Keep docs/badges/*.json in step with the tree, so the README badges need no hand edit.
@@ -2302,6 +2326,7 @@ def main():
refresh_game_table()
refresh_game_table_zh()
refresh_badges()
+ refresh_generated_indexes()
except SyncProblem: pass
if problems:
say(f'\nSYNC FAILED: {len(problems)} problem(s) — nothing committed; the working tree is left as the script wrote it, `git checkout -- .` restores it')