From a782b50ecd91050bec5e44491616febc645c0928 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 13 Aug 2017 19:54:30 -0400 Subject: [PATCH] Add options to gzip and tar to create reproducible artificats Also remove some long-unused rules from resize2fs's Makefile. Signed-off-by: Theodore Ts'o --- doc/Makefile.in | 2 +- resize/Makefile.in | 29 ----------------------------- util/gen-tarball.in | 10 ++++++++-- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/doc/Makefile.in b/doc/Makefile.in index 9cb584c..0bee4e4 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -28,7 +28,7 @@ install-doc-libs: libext2fs.info libext2fs.dvi $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i ; \ done $(E) " GZIP $(infodir)/libext2fs.info*" - -$(Q) gzip -9 $(DESTDIR)$(infodir)/libext2fs.info* + -$(Q) gzip -9n $(DESTDIR)$(infodir)/libext2fs.info* uninstall-doc-libs: $(RM) -rf $(DESTDIR)$(infodir)/libext2fs.info* diff --git a/resize/Makefile.in b/resize/Makefile.in index 6014bdd..91c1a8e 100644 --- a/resize/Makefile.in +++ b/resize/Makefile.in @@ -112,35 +112,6 @@ mostlyclean: clean distclean: clean $(RM) -f .depend Makefile $(srcdir)/TAGS $(srcdir)/Makefile.in.old -# -# Kludge to create a "special" e2fsprogs distribution file. -# - -SRCROOT = `echo e2fsprogs-@E2FSPROGS_VERSION@ | sed -e 's/-WIP//' \ - -e 's/pre-//' -e 's/-PLUS//'` -TAR=tar - -$(top_srcdir)/.exclude-file: - a=$(SRCROOT); \ - (cd $(top_srcdir)/.. ; find e2fsprogs \( -name \*~ -o -name \*.orig \ - -o -name CVS -o -name \*.rej \) -print) \ - | sed -e "s/e2fsprogs/$$a/" > $(top_srcdir)/.exclude-file - echo "$(SRCROOT)/build" >> $(top_srcdir)/.exclude-file - echo "$(SRCROOT)/rpm.log" >> $(top_srcdir)/.exclude-file - echo "$(SRCROOT)/powerquest" >> $(top_srcdir)/.exclude-file - echo "$(SRCROOT)/.exclude-file" >> $(top_srcdir)/.exclude-file - echo $(SRCROOT)/e2fsprogs-@E2FSPROGS_VERSION@.tar.gz \ - >> $(top_srcdir)/.exclude-file - echo $(SRCROOT)/e2fsprogs-ALL-@E2FSPROGS_VERSION@.tar.gz \ - >> $(top_srcdir)/.exclude-file - -source_tar_file: $(top_srcdir)/.exclude-file - (cd $(top_srcdir)/..; a=$(SRCROOT); rm -f $$a ; ln -sf e2fsprogs $$a ; \ - $(TAR) -c -h -v -f - \ - -X $$a/.exclude-file $$a | \ - gzip -9 > e2fsprogs-ALL-@E2FSPROGS_VERSION@.tar.gz) - rm -f $(top_srcdir)/.exclude-file - # +++ Dependency line eater +++ # # Makefile dependencies follow. This must be the last section in diff --git a/util/gen-tarball.in b/util/gen-tarball.in index b82f12c..a3a02ce 100644 --- a/util/gen-tarball.in +++ b/util/gen-tarball.in @@ -34,6 +34,10 @@ case $1 in ;; esac +if test -z "$SOURCE_DATE_EPOCH" ; then + export SOURCE_DATE_EPOCH=$(cd $top_srcdir; git log -1 --pretty=%ct) +fi + mv ../e2fsprogs.spec $top_srcdir/e2fsprogs.spec (cd $top_srcdir/.. ; find $base_e2fsprogs \( -name \*~ -o -name \*.orig \ -o -name CVS -o -name \*.rej -o -name Makefile.pq \ @@ -45,8 +49,10 @@ sed -e "s;^;$SRCROOT/;" < $srcdir/$list.exclude >> $exclude (cd $top_srcdir/.. ; rm -f $SRCROOT ; ln -sf $base_e2fsprogs $SRCROOT) -(cd $top_srcdir/.. ; tar -c -h -v -f - -X $exclude $SRCROOT) \ - | $GZIP -9 -c > $SRCROOT.tar.gz +(cd $top_srcdir/.. ; \ + tar -c -h -f - -X $exclude --sort=name --owner=0 --group=0 \ + --numeric-owner --mtime="@${SOURCE_DATE_EPOCH}" $SRCROOT) \ + | $GZIP -9n -c > $SRCROOT.tar.gz $GZIP -l $SRCROOT.tar.gz (cd $top_srcdir/.. ; rm -f $SRCROOT) -- 1.8.3.1