[PATCH] make release archive: common (or no) timestamps

Tomi Ollila tomi.ollila at iki.fi
Mon Dec 11 09:31:02 PST 2017


The appended file 'version' has the same timestamp as the files added
by `git archive`.

The original file name and time stamp are no longer saved to the
gzip header in resulting $(PACKAGE)-$(VERSION).tar.gz file.

When build environment is close enough to another, this may
provide mutually reproducible release archive files.
---

tested somewhat like:

$ rm -f test.tar.gz
$ make test.tar.gz TAR_FILE=test.tar.gz
$ md5sum test.tar.gz
59b22212dd006d24d09acd98cd18570a
$ sleep 2
$ rm test.tar.gz
$ make test.tar.gz TAR_FILE=test.tar.gz
$ md5sum test.tar.gz
59b22212dd006d24d09acd98cd18570a
$ rm test.tar.gz

( second try, checksums changed :O .. the reason was git-am'ed content
  *huh* ;)

 Makefile.local | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile.local b/Makefile.local
index 9505b7fee70b..49f83bc3feea 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -31,11 +31,13 @@ $(TAR_FILE):
 	fi ; \
 	git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ $$ref > $(TAR_FILE).tmp
 	echo $(VERSION) > version.tmp
+	ct=`git --no-pager log -1 --pretty=format:%ct $$ref` ; \
+	touch -d @$$ct version.tmp
 	tar --owner root --group root --append -f $(TAR_FILE).tmp \
 		--transform s_^_$(PACKAGE)-$(VERSION)/_  \
 		--transform 's_.tmp$$__' version.tmp
 	rm version.tmp
-	gzip < $(TAR_FILE).tmp > $(TAR_FILE)
+	gzip -n < $(TAR_FILE).tmp > $(TAR_FILE)
 	@echo "Source is ready for release in $(TAR_FILE)"
 
 $(SHA256_FILE): $(TAR_FILE)
-- 
2.13.3



More information about the notmuch mailing list