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

The build timestamp is embedded inside a jar embedded inside
/usr/share/java/bnd-5.0.1.jar:

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

  embedded-repo.jar

  Timestamp:·1715504316639\xd
  vs.
  Timestamp:·1681094408754\xd

The attached patch fixes this from debian/rules by replacing the
Timestamp field with SOURCE_DATE_EPOCH.


Alternately, a better fix might be to figure out exactly where the
${_@tstamp} value is derived from, and add SOURCE_DATE_EPOCH support to
that. There are various functions throughout the codebase that affect
TSTAMP, _tstamp and _@tstamp, but I could not find the right one to fix
this particular issue. In debian/patches there are a few which
presumably fix other issues by adding SOURCE_DATE_EPOCH support.


According to my local tests, with this patch applied, bnd should build
reproducibly on tests.reproducible-builds.org!

Thanks for maintaining bnd!

live well,
  vagrant
From c8c6878d524525062c7637e3215ac2758f3885aa Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Tue, 2 May 2023 16:27:07 -0700
Subject: [PATCH] debian/rules: Override the timestamp used in embedded.bnd
 with SOURCE_DATE_EPOCH.

https://reproducible-builds.org/docs/source-date-epoch/
---
 debian/rules | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/debian/rules b/debian/rules
index 17eca1c..3243b3b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -82,6 +82,9 @@ override_dh_auto_build:
 	ln -s /usr/share/java/snakeyaml.jar                     cnf/cache/$(VERSION)/bnd-cache/org.yaml.snakeyaml/org.yaml.snakeyaml-latest.jar
 	ln -s /usr/share/java/xz.jar                            cnf/cache/$(VERSION)/bnd-cache/org.tukaani.xz/org.tukaani.xz-latest.jar
 	$(RM) -r biz.aQute.repository/src/aQute/bnd/jpm # This package depends on non-free code
+
+	# Use SOURCE_DATE_EPOCH for the timestamp
+	sed -i -e "s,Timestamp:.*,Timestamp: $(SOURCE_DATE_EPOCH),g" biz.aQute.bnd.embedded-repo/bnd/embedded-repo.bnd
 	dh_auto_build -- :biz.aQute.bnd:assemble \
 	                 :biz.aQute.launcher:assemble \
 	                 :biz.aQute.junit:assemble \
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature

Reply via email to