depends: Make tarball creation from local directory reproducible

This guarantees `$(package)_sha256_hash` reproducibility regardless of
the default behavior of `$(build_TAR)`. Fixes caching on some systems,
for example, on FreeBSD.
This commit is contained in:
Hennadii Stepanov
2026-06-29 14:49:56 +01:00
parent 57b3bf8496
commit 7e973cce52

View File

@@ -47,7 +47,11 @@ endef
define fetch_local_dir_sha256
if ! [ -f $($(1)_source) ] || [ -n "$$(find $($(1)_local_dir) -newer $($(1)_source) | head -n1)" ]; then \
mkdir -p $(dir $($(1)_source)) && \
$(build_TAR) -c -f $($(1)_source) -C $($(1)_local_dir) . && \
( \
cd $($(1)_local_dir) && \
find . -print0 | TZ=UTC xargs -0r $(build_TOUCH) && \
find . | LC_ALL=C sort | $(build_TAR) --no-recursion -c -f $($(1)_source) -T - \
) && \
rm -f $($(1)_fetched); \
fi && \
if ! [ -f $($(1)_fetched) ] || [ -n "$$(find $($(1)_source) -newer $($(1)_fetched))" ]; then \