From 4599d9adcec0b4bc92027db147fb8a364914e973 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Tue, 12 Aug 2025 09:36:44 +0200 Subject: [PATCH] Makefile: release: make tarball reproducible The tarball created by git archive is reproducible, but when we append the generated manual we leak current time and the username/uid of the person running make release: tar tvf buildroot-2025.08-rc1.tar.gz | tail -rwxrwxr-x root/root 5512 2025-08-11 13:22 buildroot-2025.08-rc1/utils/update-rust drwxr-xr-x peko/peko 0 2025-08-11 17:39 buildroot-2025.08-rc1/ drwxr-xr-x peko/peko 0 2025-08-11 17:38 buildroot-2025.08-rc1/docs/ drwxr-xr-x peko/peko 0 2025-08-11 17:39 buildroot-2025.08-rc1/docs/manual/ -rw-r--r-- peko/peko 5738 2025-08-11 17:38 buildroot-2025.08-rc1/docs/manual/docbook-xsl.css -rw-r--r-- peko/peko 19029 2025-08-11 17:38 buildroot-2025.08-rc1/docs/manual/github_hash_mongrel2.png -rw-r--r-- peko/peko 638866 2025-08-11 17:39 buildroot-2025.08-rc1/docs/manual/manual.pdf -rw-r--r-- peko/peko 587892 2025-08-11 17:38 buildroot-2025.08-rc1/docs/manual/manual.html -rw-r--r-- peko/peko 393514 2025-08-11 17:39 buildroot-2025.08-rc1/docs/manual/manual.text -rw-r--r-- peko/peko 117499 2025-08-11 17:38 buildroot-2025.08-rc1/docs/manual/logo.png Fix that by forcing uid as root and setting mtime to the latest commit, similar to how we do it in support/download/{git,helpers}. Notice that we do not use --numeric-owner to match the output of git archive, so it does rely on uid 0=root, which is very likely but not guaranteed. Reported-by: Julien Olivain Signed-off-by: Peter Korsgaard Signed-off-by: Julien Olivain (cherry picked from commit fa855cbe6e024ef23ed7f4d5071956fe139168d9) Signed-off-by: Thomas Perale --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a444897d58..17575bd541 100644 --- a/Makefile +++ b/Makefile @@ -1253,7 +1253,8 @@ release: SOURCE_DATE_EPOCH=$$(git log -1 --format=%at 2> /dev/null) \ $(MAKE) O=$(OUT) manual-html manual-text manual-pdf $(MAKE) O=$(OUT) distclean - tar rf $(OUT).tar $(OUT) + tar rf $(OUT).tar --owner=0 --group=0 \ + --mtime="$$(git log -1 --pretty=format:%ci)" $(OUT) gzip -9 -c < $(OUT).tar > $(OUT).tar.gz xz -9 -c < $(OUT).tar > $(OUT).tar.xz rm -rf $(OUT) $(OUT).tar