Add a 'reproducible-tarball-dist' target
authorFabian Keil <fk@fabiankeil.de>
Thu, 25 May 2017 11:14:27 +0000 (11:14 +0000)
committerFabian Keil <fk@fabiankeil.de>
Thu, 25 May 2017 11:14:27 +0000 (11:14 +0000)
It's currently separate from the "tarball-dist" target
because it requires a tar implementation with mtree spec
support.

It's far from being perfect and does not enforce a
reproducible mode, but it's better than nothing.

After the git migration it can probably be removed anyway.

GNUmakefile.in
configure.in

index e2fba66..15f7656 100644 (file)
@@ -1,6 +1,6 @@
 # Note:  GNUmakefile is built automatically from GNUmakefile.in
 #
 # Note:  GNUmakefile is built automatically from GNUmakefile.in
 #
-# $Id: GNUmakefile.in,v 1.259 2017/05/04 14:35:02 fabiankeil Exp $
+# $Id: GNUmakefile.in,v 1.260 2017/05/20 09:27:07 fabiankeil Exp $
 #
 # Written by and Copyright (C) 2001-2017 members of the
 # Privoxy team. https://www.privoxy.org/
 #
 # Written by and Copyright (C) 2001-2017 members of the
 # Privoxy team. https://www.privoxy.org/
@@ -44,6 +44,8 @@ CODE_STATUS   = @CODE_STATUS@
 VERSION       = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
 SNAPVERSION   = $(VERSION)-$(shell date "+%Y%m%d")
 
 VERSION       = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
 SNAPVERSION   = $(VERSION)-$(shell date "+%Y%m%d")
 
+SOURCE_DATE_EPOCH = @SOURCE_DATE_EPOCH@
+MTREE_SPEC_FILE = privoxy-$(VERSION)-$(CODE_STATUS).spec
 
 #############################################################################
 # "make install" directories and variables
 
 #############################################################################
 # "make install" directories and variables
@@ -419,6 +421,27 @@ tarball-dist: dist-check clean clobber
        $(GZIP_PROG) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
        @$(ECHO) Tarball distribution created.
 
        $(GZIP_PROG) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
        @$(ECHO) Tarball distribution created.
 
+# Create a mtree spec file that can be used to get a reproducible tar ball
+mtree-spec:
+       $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
+       $(ECHO) "#mtree 2.0" > $(MTREE_SPEC_FILE)
+       for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
+       -o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
+       -name "PACKAGERS" -o -path "*.git/*" -o -name "*.spec" \) | env -i sort`; do \
+          $(ECHO) "privoxy-$(VERSION)-$(CODE_STATUS)/$$i time=$(SOURCE_DATE_EPOCH) type=file uname=privoxy gname=privoxy mode=0555"; \
+       done >> $(MTREE_SPEC_FILE)
+       $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
+
+# Create a reproducible tarball.
+# Requires a tar implementation with mtree support.
+reproducible-tarball-dist: dist-check clean clobber mtree-spec
+       $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
+
+       $(TAR) cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar -C .. @privoxy-$(VERSION)-$(CODE_STATUS)/$(MTREE_SPEC_FILE)
+       $(GZIP_PROG) -n privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
+       $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS) $(MTREE_SPEC_FILE)
+       @$(ECHO) Reproducible tarball distribution created.
+
 # anonymously ncftps the tarball to sourceforge
 tarball-upload:
        ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
 # anonymously ncftps the tarball to sourceforge
 tarball-upload:
        ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
index e9d655c..7df0b50 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl $Id: configure.in,v 1.209 2017/05/04 14:34:18 fabiankeil Exp $
+dnl $Id: configure.in,v 1.210 2017/05/04 14:34:28 fabiankeil Exp $
 dnl
 dnl Written by and Copyright (C) 2001-2017 the
 dnl Privoxy team. https://www.privoxy.org/
 dnl
 dnl Written by and Copyright (C) 2001-2017 the
 dnl Privoxy team. https://www.privoxy.org/
@@ -32,7 +32,7 @@ dnl =================================================================
 dnl AutoConf Initialization
 dnl =================================================================
 
 dnl AutoConf Initialization
 dnl =================================================================
 
-AC_REVISION($Revision: 1.209 $)
+AC_REVISION($Revision: 1.210 $)
 AC_INIT(jcc.c)
 
 if test ! -f config.h.in; then
 AC_INIT(jcc.c)
 
 if test ! -f config.h.in; then
@@ -81,6 +81,10 @@ VERSION_MINOR=0
 VERSION_POINT=27
 CODE_STATUS="UNRELEASED"
 
 VERSION_POINT=27
 CODE_STATUS="UNRELEASED"
 
+dnl Timestamp (date +%s) used by the mtree-spec target.
+dnl Should be updated before releases but forgetting it isn't critical.
+SOURCE_DATE_EPOCH=1494070262
+
 dnl CODE_STATUS can be "alpha", "beta", "stable" or "UNRELEASED",
 dnl and will be used for CGI output. Increment version number and
 dnl set status to "UNRELEASED" whenever CVS differs from the last
 dnl CODE_STATUS can be "alpha", "beta", "stable" or "UNRELEASED",
 dnl and will be used for CGI output. Increment version number and
 dnl set status to "UNRELEASED" whenever CVS differs from the last
@@ -94,6 +98,7 @@ AC_SUBST(VERSION_MAJOR)
 AC_SUBST(VERSION_MINOR)
 AC_SUBST(VERSION_POINT)
 AC_SUBST(CODE_STATUS)
 AC_SUBST(VERSION_MINOR)
 AC_SUBST(VERSION_POINT)
 AC_SUBST(CODE_STATUS)
+AC_SUBST(SOURCE_DATE_EPOCH)
 
 dnl
 AC_DEFINE_UNQUOTED(VERSION_MAJOR,${VERSION_MAJOR})
 
 dnl
 AC_DEFINE_UNQUOTED(VERSION_MAJOR,${VERSION_MAJOR})