Co-authored-by: Ken Jin <kenjin4096@gmail.com>
--- /dev/null
+When calculating the digest of the JIT stencils input, sort the hashed files
+by filenames before adding their content to the hasher. This ensures
+deterministic hash input and hence deterministic hash, independent on
+filesystem order.
# Exclude cache files from digest computation to ensure reproducible builds.
if dirpath.endswith("__pycache__"):
continue
- for filename in filenames:
+ for filename in sorted(filenames):
hasher.update(pathlib.Path(dirpath, filename).read_bytes())
return hasher.hexdigest()