From 25992b4fd190d43b29df6a7fd641f9a9e2560698 Mon Sep 17 00:00:00 2001 From: zhifu gao Date: Wed, 2 Dec 2026 04:07:46 +0800 Subject: [PATCH] Make source ZIPs independent of the build time zone Use UTC for git archive so the ZIP wall-clock timestamp and SHA256SUMS agree across build hosts. Compare two fixed-offset time zones in the existing artifact regression. Signed-off-by: LauraGPT --- scripts/build_release_assets.py | 2 ++ tests/test_release_contract.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/build_release_assets.py b/scripts/build_release_assets.py index b31b2ae..c90e601 100644 --- a/scripts/build_release_assets.py +++ b/scripts/build_release_assets.py @@ -99,6 +99,8 @@ def build_release_assets(repository, ref, output_dir): f"--output={archive_path}", commit, ], + # Git records local wall time in ZIP headers, even for a fixed commit. + env={**os.environ, "TZ": "UTC0"}, check=True, ) validate_members(archive_members(archive_path), prefix) diff --git a/tests/test_release_contract.py b/tests/test_release_contract.py index d3144c4..ee12880 100644 --- a/tests/test_release_contract.py +++ b/tests/test_release_contract.py @@ -147,7 +147,7 @@ def test_release_builder_creates_reproducible_scoped_archives(tmp_path): _create_fixture_repository(repository) outputs = [] - for directory_name in ("dist-one", "dist-two"): + for directory_name, timezone in (("dist-one", "UTC0"), ("dist-two", "UTC-8")): if outputs: time.sleep(2) output_dir = tmp_path / directory_name @@ -162,6 +162,7 @@ def test_release_builder_creates_reproducible_scoped_archives(tmp_path): "--output-dir", str(output_dir), ], + env={**os.environ, "TZ": timezone}, check=True, ) outputs.append(output_dir)