Debian Codegraph @

debian/patches/Make-generated-doc-data-hash-deterministic.patch

raw
1 From: Travis Wrightsman <[email protected]>
2 Date: Fri, 10 Jul 2026 20:40:20 -0700
3 Subject: Make generated doc data hash deterministic
4
5 Python's build-in hash() is intentionally randomized between processes. This
6 prevents Godot from building reproducibly since identical source input produces
7 different hashed values each build. SHA-256 is used here as a deterministic
8 alternative hash function.
9
10 Forwarded: https://github.com/godotengine/godot/pull/121235
11 ---
12 editor/editor_builders.py | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15 diff --git a/editor/editor_builders.py b/editor/editor_builders.py
16 index 43b434f..57b7424 100644
17 --- a/editor/editor_builders.py
18 +++ b/editor/editor_builders.py
19 @@ -1,5 +1,6 @@
20 """Functions used to generate source files during build time"""
21
22 +import hashlib
23 import os
24 import os.path
25 import subprocess
26 @@ -59,7 +60,7 @@ def make_doc_header(target, source, env):
27
28 with methods.generated_wrapper(str(target[0])) as file:
29 file.write(f"""\
30 -inline constexpr const char *_doc_data_hash = "{hash(buffer)}";
31 +inline constexpr const char *_doc_data_hash = "{hashlib.sha256(buffer).hexdigest()}";
32 inline constexpr int _doc_data_compressed_size = {len(buffer)};
33 inline constexpr int _doc_data_uncompressed_size = {decomp_size};
34 inline constexpr const unsigned char _doc_data_compressed[] = {{