Source: antlr
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Timestamps are embedded in the antlr.jar file:

  
https://tests.reproducible-builds.org/debian/rb-pkg/bullseye/amd64/diffoscope-results/antlr.html

  ./usr/share/java/antlr-2.7.7.jar

  
System.err.println("ANTLR·Parser·Generator···Version·2.7.7·(20210621)···1989-2005");
  vs.
  
System.err.println("ANTLR·Parser·Generator···Version·2.7.7·(20220726)···1989-2005");

  Tool.version·=·"2.7.7·(20210621)";
  vs.
  Tool.version·=·"2.7.7·(20220726)";

  public·static·final·String·datestamp·=·"20210621";
  vs.
  public·static·final·String·datestamp·=·"20220726";

  public·static·final·String·project_version·=·"2.7.7·(20210621)";
  vs.
  public·static·final·String·project_version·=·"2.7.7·(20220726)";


The attached patches fix this by adding support for SOURCE_DATE_EPOCH to
configure.in and Makefile.in.


With these patches applied (and the recently submitted patch regarding
example Makefiles), antlr should become reproducible on the
tests.reproducible-builds.org infrastructure.


Thanks for maintaining antlr!


live well,
  vagrant
From 720ef9012317fd3254c5f4624fc076627d7ad434 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Wed, 14 Jul 2021 14:25:12 +0000
Subject: [PATCH 2/3] configure.in: Set timestamp from SOURCE_DATE_EPOCH
 variable.

https://reproducible-builds.org/docs/source-date-epoch/
---
 configure.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.in b/configure.in
index 8100f62a..c9aa8db0 100644
--- a/configure.in
+++ b/configure.in
@@ -111,7 +111,11 @@ AC_SUBST([APTC])
 VERSION=`echo $PACKAGE_VERSION | cut -d . -f 1`
 SUBVERSION=`echo $PACKAGE_VERSION | cut -d . -f 2`
 PATCHLEVEL=`echo $PACKAGE_VERSION | cut -d . -f 3`
-TIMESTAMP=`date +%Y%m%d`
+# Set TIMESTAMP from SOURCE_DATE_EPOCH
+# https://reproducible-builds.org/docs/source-date-epoch/
+SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
+DATE_FMT="+%Y%m%d"
+TIMESTAMP=`date -u -d "@$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u "$DATE_FMT"`
 
 ## @abs_this_builddir@  - absolute path to top of build directory.
 ## According to GNU autoconf we can rely on that there's a proper
-- 
2.32.0

From 70f31c66e4e8b0d3a2b9a66a3edfed74f991c2a4 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Wed, 14 Jul 2021 14:27:53 +0000
Subject: [PATCH 3/3] Makefile.in: Set timestamp from SOURCE_DATE_PEOCH
 environment variable.

https://reproducible-builds.org/docs/source-date-epoch/
---
 Makefile.in | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 8fa86d69..e44ca4b8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -46,7 +46,14 @@ maintainer-clean: distclean
 # Rule to make a tarball exclusive all kinds of fluff
 #
 
-TIMESTAMP       = $(shell date +%Y%m%d)
+# Set TIMESTAMP from SOURCE_DATE_EPOCH
+# https://reproducible-builds.org/docs/source-date-epoch/
+DATE_FMT = +%Y%m%d
+ifdef SOURCE_DATE_EPOCH
+    TIMESTAMP ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
+else
+    TIMESTAMP ?= $(shell date "$(DATE_FMT)")
+endif
 TAR_DIR         = $(versioneddir)
 TAR_FILE	      = $(versioneddir).tar
 
-- 
2.32.0

Attachment: signature.asc
Description: PGP signature

Reply via email to