[Debian-astro-maintainers] Bug#1040904: unity-java: please make the build reproducible

Chris Lamb lamby at debian.org
Wed Jul 12 09:32:05 BST 2023


Source: unity-java
Version: 1.1~b1+dfsg-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
unity-java could not be built reproducibly.

This is because it shipped a 'STAMP' file within the .jar that contained
the current build date. I'm not convinced by the value of including this
file, but a patch is attached that ensures that the content of this file
is based on the value of SOURCE_DATE_EPOCH if it is available.

Patch attached.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/debian/patches/Reproducible-build.patch	1970-01-01 01:00:00.000000000 +0100
--- b/debian/patches/Reproducible-build.patch	2023-07-12 09:30:30.471901700 +0100
@@ -0,0 +1,27 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby at debian.org>
+Last-Update: 2023-07-12
+
+--- unity-java-1.1~b1+dfsg.orig/src/java/Makefile.in
++++ unity-java-1.1~b1+dfsg/src/java/Makefile.in
+@@ -33,6 +33,11 @@ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ bindir=@bindir@
+ 
++ifdef SOURCE_DATE_EPOCH
++    BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" 2>/dev/null || date -u)
++else
++    BUILD_DATE ?= $(shell date)
++endif
+ 
+ all: unity.jar
+ 
+@@ -49,7 +54,7 @@ unity.jar: build/$(CP)/UnitParser.class
+ build/STAMP:
+ 	mkdir -p build/jdk
+ 	mkdir -p gen/$(CP)
+-	date >build/STAMP
++	echo $(BUILD_DATE) >build/STAMP
+ 
+ build/$(CP)/UnitParser.class: $(CP)/UnitParser.java \
+ 		$(CP)/OneUnit.java \
--- a/debian/patches/series	2023-07-12 09:27:01.315266534 +0100
--- b/debian/patches/series	2023-07-12 09:30:28.083894735 +0100
@@ -1,3 +1,4 @@
 Remove-Java-compatibility-restrictions-from-javac-call.patch
 Fix-glitches-in-documentation-generation.patch
 Disable-failing-test.patch
+Reproducible-build.patch


More information about the Debian-astro-maintainers mailing list