feat(build-time-versioning): xceadmin generates build-info module

xceadmin/meson.build passes the resolved commit_id/build_time meson
options as two new positional args (matching this custom_target's
existing all-positional style) to meson-build.sh, which writes a small
_build_info.py (GIT_COMMIT/BUILD_TIME, independent per-field "unknown"
fallback) into the mirrored source tree's xceadmin package directory,
before the pip install step -- same before-install ordering as the
existing schema-sync step. A file-existence guard checks the exact path
just written and fails loudly rather than silently proceeding with a
missing/wrong module.

Live-verified via a full real build+test+wheel cycle (run independently
twice, once by implementation and once by review): the mirrored tree's
_build_info.py and the packaged wheel both contain real, matching,
non-"unknown" values (commit id matching git rev-parse --short HEAD plus
dirty suffix, real UTC timestamp); full pytest suite passes (258 passed,
3 skipped -- documented live-HA e2e tests, skip-by-design).

Task 5.1/13 of build-time-versioning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-20 14:22:45 +00:00
parent fb09afe6be
commit e1cd9d257c
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 55 additions and 5 deletions

View file

@ -40,6 +40,16 @@ xceadmin_stamp = custom_target('xceadmin',
meson.current_source_dir() / '..' / '..', # repo root (contains ha/, src/)
python3_prog.full_path(),
'@OUTPUT@',
# build-time-versioning task 5.1: same resolved commit_id/build_time
# option values src/meson.build:30-31 (C) and apiserver/xcecli's
# meson.build (Go, via XCE_GIT_COMMIT/XCE_BUILD_TIME) already thread
# through -- passed here as two more positional args, matching this
# custom_target's existing positional (not env-var) style. Empty when
# unset (meson.options' default); meson-build.sh is responsible for the
# empty -> "unknown" fallback, same discipline as go_build's
# XCE_GIT_COMMIT/XCE_BUILD_TIME handling.
get_option('commit_id'),
get_option('build_time'),
],
build_by_default: true,
build_always_stale: true,