From bd49bc34d9a2c0d8250eba172feafb4a246ef56e Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 23 Oct 2026 14:04:39 -0700 Subject: [PATCH] [sync_deps.py] Touch Binaryen's `config.h.in` after syncing Binaryen currently only runs `git describe` when configuring CMake, so switching git revisions and running an incremental build leaves `config.h` (and `wasm-opt --version`) stale unless CMake re-runs. This can cause the version check added in #28053 to report a stale Binaryen revision after running `tools/maint/sync_deps.py`. Touch `config.h.in` after checking out a new Binaryen revision so CMake re-runs on the next build. See: https://github.com/WebAssembly/binaryen/pull/9299 --- tools/maint/sync_deps.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/maint/sync_deps.py b/tools/maint/sync_deps.py index efb8455fb3962..40bbb4141ba82 100755 --- a/tools/maint/sync_deps.py +++ b/tools/maint/sync_deps.py @@ -125,7 +125,7 @@ def sync_repo(name, repo_dir, revision, url): cur_rev = get_current_revision(repo_dir) if cur_rev.startswith(revision) or revision.startswith(cur_rev): print(' already at the requested revision') - return + return False if is_dirty(repo_dir): utils.exit_with_error(f"Directory for {name} is dirty: '{repo_dir}'") @@ -144,6 +144,8 @@ def sync_repo(name, repo_dir, revision, url): if not DRY_RUN: subprocess.check_call(['git', '-C', repo_dir, 'checkout', revision]) + return True + def main(): parent_dir = os.path.dirname(utils.path_from_root()) @@ -175,7 +177,17 @@ def main(): revisions = get_deps_revisions() sync_repo('llvm-project', args.llvm_dir, revisions['llvm_project_revision'], LLVM_URL) - sync_repo('binaryen', args.binaryen_dir, revisions['binaryen_revision'], BINARYEN_URL) + if sync_repo('binaryen', args.binaryen_dir, revisions['binaryen_revision'], BINARYEN_URL): + # Binaryen only runs `git describe` when configuring CMake, so switching + # git revisions without re-running CMake leaves `config.h` (and `wasm-opt + # --version`) stale. Touch `config.h.in` to force CMake to re-run on the + # next build. See https://github.com/WebAssembly/binaryen/pull/9299. + config_h_in = os.path.join(args.binaryen_dir, 'config.h.in') + if os.path.exists(config_h_in): + if VERBOSE: + print(f' Touching {config_h_in}') + if not DRY_RUN: + os.utime(config_h_in) print('Done.')