[Git][java-team/h2database][master] Create reproducible zip files in the jar

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Fri Oct 16 10:10:25 BST 2026



Emmanuel Bourg pushed to branch master at Debian Java Maintainers / h2database


Commits:
b86666cd by Emmanuel Bourg at 2026-10-16T10:54:39+02:00
Create reproducible zip files in the jar

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/reproducible-zip-files.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+h2database (2.5.252-2) unstable; urgency=medium
+
+  * Create reproducible zip files in the jar
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Fri, 16 Oct 2026 01:49:07 +0200
+
 h2database (2.5.252-1) unstable; urgency=medium
 
   * New upstream release


=====================================
debian/patches/reproducible-zip-files.patch
=====================================
@@ -0,0 +1,37 @@
+Description: Create reproducible zip and jar files
+ The entries were stored in the order returned by the filesystem and with
+ the current time, which makes org/h2/util/data.zip differ between builds.
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: no
+--- a/src/tools/org/h2/build/BuildBase.java
++++ b/src/tools/org/h2/build/BuildBase.java
+@@ -36,6 +36,8 @@
+ import java.nio.file.attribute.BasicFileAttributes;
+ import java.security.MessageDigest;
+ import java.security.NoSuchAlgorithmException;
++import java.time.LocalDateTime;
++import java.time.ZoneOffset;
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Comparator;
+@@ -830,6 +832,8 @@
+                     return p1.compareTo(p2);
+                 }
+             });
++        } else {
++            files.sort(Comparator.naturalOrder());
+         }
+         Path dest = Paths.get(destFile).toAbsolutePath();
+         mkdirs(dest.getParent());
+@@ -855,6 +859,11 @@
+                 String entryName = base.relativize(file).toString().replace('\\', '/');
+                 byte[] data = readFile(file);
+                 ZipEntry entry = new ZipEntry(entryName);
++                String sourceDateEpoch = System.getenv("SOURCE_DATE_EPOCH");
++                if (sourceDateEpoch != null) {
++                    entry.setTimeLocal(LocalDateTime.ofEpochSecond(
++                            Long.parseLong(sourceDateEpoch), 0, ZoneOffset.UTC));
++                }
+                 CRC32 crc = new CRC32();
+                 crc.update(data);
+                 entry.setSize(data.length);


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 use-jar-files-from-debian.patch
 osgi.service.jdbc.patch
 jakarta-servlet-api.patch
+reproducible-zip-files.patch



View it on GitLab: https://salsa.debian.org/java-team/h2database/-/commit/b86666cd3f1a138d2c60e7521edad04aeb59d53c

-- 
View it on GitLab: https://salsa.debian.org/java-team/h2database/-/commit/b86666cd3f1a138d2c60e7521edad04aeb59d53c
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261016/de650235/attachment.htm>


More information about the pkg-java-commits mailing list