Package: opentest4j Severity: normal Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps timezone X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
The shipped opentest4j-1.2.0.jar embeds the time, date and timezone in the build: https://tests.reproducible-builds.org/debian/rb-pkg/bullseye/amd64/diffoscope-results/opentest4j.html ./usr/share/java/opentest4j-1.2.0.jar Build-Date:·2022-07-12\xd vs. Build-Date:·2021-06-09\xd Build-Time:·01:50:58.592-1200\xd vs. Build-Time:·21:32:48.944+1400\xd The attached patch modifies build.gradle to set the timezone to UTC when the SOURCE_DATE_EPOCH environment variable is defined, and use SOURCE_DATE_EPOCH to set the timestamp. With this patch applied, opentest4j should become reproducible in the tests.reproducible-builds.org infrastructure. Thanks for maintaining opentest4j! live well, vagrant
From 851b4d88d014df82203851919906b0925b21bc1f Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian <vagr...@reproducible-builds.org> Date: Thu, 8 Jul 2021 23:38:36 +0000 Subject: [PATCH] debian/patches: Support reproducible timestamps in the .jar file. Patch build.gradle to use SOURCE_DATE_EPOCH to avoid embedding timestamp in .jar file. https://reproducible-builds.org/docs/source-date-epoch/ --- .../04-reproducible-builds-timestamp.patch | 25 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 26 insertions(+) create mode 100644 debian/patches/04-reproducible-builds-timestamp.patch diff --git a/debian/patches/04-reproducible-builds-timestamp.patch b/debian/patches/04-reproducible-builds-timestamp.patch new file mode 100644 index 0000000..e92cde4 --- /dev/null +++ b/debian/patches/04-reproducible-builds-timestamp.patch @@ -0,0 +1,25 @@ +Add support for SOURCE_DATE_EPOCH to avoid embedding timestamp in .jar +file. + +https://reproducible-builds.org/docs/source-date-epoch/ + +Index: opentest4j/build.gradle +=================================================================== +--- opentest4j.orig/build.gradle ++++ opentest4j/build.gradle +@@ -9,7 +9,14 @@ plugins { + id 'signing' + } + +-Date buildTimeAndDate = new Date() ++// https://reproducible-builds.org/docs/source-date-epoch/ ++String source_date_epoch = System.getenv("SOURCE_DATE_EPOCH"); ++if (source_date_epoch != null) { ++ TimeZone.setDefault(TimeZone.getTimeZone("UTC")) ++} ++Date buildTimeAndDate = source_date_epoch == null ? ++ new Date() : ++ new Date(1000 * Long.parseLong(source_date_epoch)) + ext { + buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate) + buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate) diff --git a/debian/patches/series b/debian/patches/series index 856631a..cb3366e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 01-ignore-versioning-plugin.patch 02-ignore-github-pages-plugin.patch 03-ignore-spotless-plugin.patch +04-reproducible-builds-timestamp.patch -- 2.32.0
signature.asc
Description: PGP signature