diff mbox series

[bug#70169,2/7] maint: Use reproducible timestamps and name for tarball.

Message ID 05e6677d56a3a23ae8526cc56c14c7de33a8254a.1712165977.git.janneke@gnu.org
State New
Headers show
Series Reproducible `make dist' tarball in defiance of Autotools and Gettext | expand

Commit Message

Janneke Nieuwenhuizen April 3, 2024, 7:11 p.m. UTC
* Makefile.am (gen-tarball-version): Add reproducible timestamp to tarball.
(am__tar): Use it in new variable, overriding the Automake default.
(GZIP_ENV): New variable, overriding the Automake default.

Change-Id: Iea5c2f80eaf24b2f2d80e651c73c348231de8d63
---
 Makefile.am | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Ludovic Courtès April 3, 2024, 8:45 p.m. UTC | #1
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:

> +# Reproducible tarball
> +GZIP_ENV = --no-name

Looks like Automake can feel the defiance:

--8<---------------cut here---------------start------------->8---
Makefile.am:1007: warning: user variable 'GZIP_ENV' defined here ...
/gnu/store/lynhxxaygrbw0z05bwsc5c3i5r5qdv38-automake-1.16.5/share/automake-1.16/am/distdir.am: ... overrides Automake variable 'GZIP_ENV' defined here
--8<---------------cut here---------------end--------------->8---

Probably nothing to worry about, though IWBN if we could silence it.

Ludo’.
Janneke Nieuwenhuizen April 3, 2024, 8:49 p.m. UTC | #2
Ludovic Courtès writes:

> Janneke Nieuwenhuizen <janneke@gnu.org> skribis:
>
>> +# Reproducible tarball
>> +GZIP_ENV = --no-name

Hmm, should we add `--best' here too?

> Looks like Automake can feel the defiance:
>
> Makefile.am:1007: warning: user variable 'GZIP_ENV' defined here ...
> /gnu/store/lynhxxaygrbw0z05bwsc5c3i5r5qdv38-automake-1.16.5/share/automake-1.16/am/distdir.am: ... overrides Automake variable 'GZIP_ENV' defined here
>
> Probably nothing to worry about, though IWBN if we could silence it.

Yes, indeed... (Help! :)

Janneke
diff mbox series

Patch

diff --git a/Makefile.am b/Makefile.am
index 2b5e145095..c33d69ed9f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,7 @@ 
 # Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 # Copyright © 2017 Leo Famulari <leo@famulari.name>
 # Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
-# Copyright © 2017, 2020, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
+# Copyright © 2017, 2020, 2023, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 # Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 # Copyright © 2018 Nikita <nikita@n0.is>
 # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
@@ -970,6 +970,7 @@  $(top_srcdir)/.version: config.status
 
 gen-tarball-version:
 	echo $(VERSION) > "$(distdir)/.tarball-version"
+	git show HEAD --format=%ct --no-patch > $(distdir)/.tarball-timestamp
 
 gen-ChangeLog:
 	$(AM_V_GEN)if test -e .git; then		\
@@ -1002,6 +1003,17 @@  dist-with-updated-version:
 # Release management.
 #
 
+# Reproducible tarball
+GZIP_ENV = --no-name
+# Be friendly to Debian; avoid using EPOCH
+am__tar = $${TAR-tar}				\
+ --sort=name					\
+ --mode=go=rX,u+rw,a-s				\
+ --mtime=@$$(cat "$$tardir"/.tarball-timestamp)	\
+ --owner=0 --group=0 --numeric-owner		\
+ -cf -						\
+ "$$tardir"
+
 releasedir = release-$(PACKAGE_VERSION)
 
 PACKAGE_FULL_TARNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)