BT_EXPIRE: tester builds stop working 14 days after build (compile gate)
Distributed test zips go stale and stray. BT_EXPIRE (CMake option,
DEFAULT ON so a zip can never accidentally ship without it) makes the
exe refuse to start BT_EXPIRE_DAYS (default 14) after its build day:
boot logs the remaining window, an expired build logs + shows a
"test build expired -- ask the operator for the current build" box and
exits. btversion.h now stamps BT_BUILD_UNIX (UTC-midnight-rounded so
the only-on-change header churns once per day, not every build) +
BT_BUILD_DATE. Dev is unaffected: every build re-stamps the day.
-DBT_EXPIRE=OFF builds a non-expiring exe; mkdist reads the cache and
marks such a zip "-noexpire" + prints a warning, and the tester README
expiry note is {EXPIRE}-marker-gated like the steam lines. Second
compile-gate exception after BT_STEAM (convention updated in
glass-cockpit.md). Quality gate, not DRM -- a clock rollback defeats it.
Verified live: default build logs "test build window: 14 day(s) left";
a -DBT_EXPIRE_DAYS=0 build logs TEST BUILD EXPIRED and parks on the
explanation box (window title checked) without starting the game;
restored to 14 and rebuilt clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
753540de96
commit
eb618fe9e6
@@ -7,6 +7,13 @@
|
||||
#
|
||||
# Invoked: cmake -DOUT=<header> -DSRC=<repo root> -P btversion.cmake
|
||||
|
||||
# Build DAY stamp (UTC midnight epoch) for the tester-build expiry tripwire
|
||||
# (BT_EXPIRE). Day precision on purpose: the header is written only-on-change,
|
||||
# so a per-second stamp would churn btl4main.obj on every no-op build.
|
||||
string(TIMESTAMP BT_NOW_UNIX "%s" UTC)
|
||||
math(EXPR BT_BUILD_UNIX "(${BT_NOW_UNIX} / 86400) * 86400")
|
||||
string(TIMESTAMP BT_BUILD_DATE "%Y-%m-%d" UTC)
|
||||
|
||||
execute_process(COMMAND git rev-list --count HEAD
|
||||
WORKING_DIRECTORY "${SRC}"
|
||||
OUTPUT_VARIABLE BT_BUILD OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -44,6 +51,8 @@ set(CONTENT "// generated by tools/btversion.cmake -- do not edit, not in git
|
||||
#define BT_VERSION_STRING \"4.11.${BT_BUILD}\"
|
||||
#define BT_VERSION_HASH \"${BT_HASH}${BT_DIRTY}\"
|
||||
#define BT_VERSION_FULL \"4.11.${BT_BUILD} (${BT_HASH}${BT_DIRTY})\"
|
||||
#define BT_BUILD_UNIX ${BT_BUILD_UNIX}
|
||||
#define BT_BUILD_DATE \"${BT_BUILD_DATE}\"
|
||||
")
|
||||
|
||||
# write only when changed so incremental builds don't churn
|
||||
|
||||
@@ -54,6 +54,7 @@ def main():
|
||||
# the CMake cache; a steam-OFF zip must carry neither play_steam.bat nor
|
||||
# steam_api.dll (a stale DLL can linger from an earlier ON build).
|
||||
steam_on = False
|
||||
cache = ""
|
||||
try:
|
||||
cache = open("build/CMakeCache.txt", encoding="utf-8", errors="ignore").read()
|
||||
steam_on = "BT_STEAM:BOOL=ON" in cache
|
||||
@@ -62,6 +63,15 @@ def main():
|
||||
print(" BT_STEAM=%s (from build/CMakeCache.txt)" % ("ON" if steam_on else "OFF"))
|
||||
if not steam_on:
|
||||
name += "-nosteam" # distinct name: never clobbers the dev-flavor zip
|
||||
|
||||
# TESTER-BUILD EXPIRY (BT_EXPIRE, default ON): a zip cut from an
|
||||
# expire-OFF build never dies in the field -- mark it loudly so it is a
|
||||
# deliberate act, not an accident.
|
||||
expire_on = "BT_EXPIRE:BOOL=ON" in cache if cache else True
|
||||
print(" BT_EXPIRE=%s (from build/CMakeCache.txt)" % ("ON" if expire_on else "OFF"))
|
||||
if not expire_on:
|
||||
name += "-noexpire"
|
||||
print(" WARNING: this zip NEVER EXPIRES -- intended for distribution?")
|
||||
zpath = os.path.join(outdir, name + ".zip")
|
||||
|
||||
exes = ["build/Release/btl4.exe"]
|
||||
@@ -102,6 +112,10 @@ def main():
|
||||
lines = [l.replace("{STEAM}", "") for l in lines]
|
||||
else: # steam-free zip: strip them
|
||||
lines = [l for l in lines if "{STEAM}" not in l]
|
||||
if expire_on: # same treatment for expiry note
|
||||
lines = [l.replace("{EXPIRE}", "") for l in lines]
|
||||
else:
|
||||
lines = [l for l in lines if "{EXPIRE}" not in l]
|
||||
readme = "".join(lines)
|
||||
z.writestr(name + "/README.txt", readme)
|
||||
for p in bats: # bats at the zip ROOT (next to
|
||||
|
||||
Reference in New Issue
Block a user