[Git][java-team/mathpiper][master] 5 commits: Make the Lisp image reproducible

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Tue Oct 20 14:03:54 BST 2026



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


Commits:
319309a9 by Emmanuel Bourg at 2026-10-20T13:18:08+02:00
Make the Lisp image reproducible

- - - - -
88743fa6 by Emmanuel Bourg at 2026-10-20T13:18:08+02:00
Standards-Version updated to 4.7.4

- - - - -
3f3b2599 by Emmanuel Bourg at 2026-10-20T13:18:08+02:00
Removed the Priority field

- - - - -
1975b520 by Emmanuel Bourg at 2026-10-20T13:19:15+02:00
Wrap and sort

- - - - -
b35c1e0a by Emmanuel Bourg at 2026-10-20T13:19:37+02:00
Upload to unstable

- - - - -


5 changed files:

- debian/changelog
- debian/control
- − debian/patches/reproducible
- + debian/patches/reproducible-image
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+mathpiper (0.81f+svn4469+dfsg3-5) unstable; urgency=medium
+
+  * Team upload.
+  * Make the Lisp image reproducible
+  * Standards-Version updated to 4.7.4
+  * Removed the Priority field
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Tue, 20 Oct 2026 13:19:24 +0200
+
 mathpiper (0.81f+svn4469+dfsg3-4) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -2,24 +2,22 @@ Source: mathpiper
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Giovanni Mascellani <gio at debian.org>
 Section: java
-Priority: optional
-Build-Depends: debhelper-compat (= 13),
-               javahelper,
-               default-jdk,
-               libjfreechart-java,
-               libjdom1-java,
-               libjas-java,
-               libjlatexmath-java
-Standards-Version: 4.7.0
+Build-Depends:
+ debhelper-compat (= 13),
+ default-jdk,
+ javahelper,
+ libjas-java,
+ libjdom1-java,
+ libjfreechart-java,
+ libjlatexmath-java
+Standards-Version: 4.7.4
 Vcs-Browser: https://salsa.debian.org/java-team/mathpiper
 Vcs-Git: https://salsa.debian.org/java-team/mathpiper.git
 Homepage: https://www.mathpiper.org/
 
 Package: mathpiper
 Architecture: all
-Depends: ${shlibs:Depends},
-         ${misc:Depends},
-         ${java:Depends}
+Depends: ${java:Depends}, ${misc:Depends}, ${shlibs:Depends}
 Description: Java Computer Algebra System
  Mathpiper is a CAS (Computer Algebra System), written in Java. It is part
  of the mathrider suite, a mathematics computing environment for


=====================================
debian/patches/reproducible deleted
=====================================
@@ -1,13 +0,0 @@
-Index: mathpiper/src/org/mathpiper/mpreduce/packagedatastore/PDSOutputStream.java
-===================================================================
---- mathpiper.orig/src/org/mathpiper/mpreduce/packagedatastore/PDSOutputStream.java
-+++ mathpiper/src/org/mathpiper/mpreduce/packagedatastore/PDSOutputStream.java
-@@ -76,7 +76,7 @@ public void close() throws IOException
-     pds.f.write(length >> 16);
-     pds.f.write(length >> 8);
-     pds.f.write(length);
--    long date = new Date().getTime();
-+    long date = 0;
-     pds.f.write((int)(date >> 56));
-     pds.f.write((int)(date >> 48));
-     pds.f.write((int)(date >> 40));


=====================================
debian/patches/reproducible-image
=====================================
@@ -0,0 +1,149 @@
+Description: Make the Lisp image reproducible
+ The image recorded the build date (date!*, the image birthday and the date of
+ each member) in the local time zone and locale. Replacing a member also left
+ its old content in the file, a HeapImage of varying size holding timing
+ information: the file is now rewritten without it.
+Author: Giovanni Mascellani <gio at debian.org>, Emmanuel Bourg <ebourg at apache.org>
+Forwarded: no
+--- a/src/org/mathpiper/mpreduce/Jlisp.java
++++ b/src/org/mathpiper/mpreduce/Jlisp.java
+@@ -63,6 +63,7 @@
+ import java.text.DateFormat;
+ import java.util.Date;
+ import java.util.HashMap;
++import java.util.Locale;
+ import java.util.TimeZone;
+ import java.util.Vector;
+ import java.util.zip.GZIPInputStream;
+@@ -689,9 +690,7 @@
+ 			// testing.
+ 			if (!loaded)
+ 			{   initSymbols();
+-				DateFormat df = DateFormat.getInstance();
+-				df.setTimeZone(TimeZone.getDefault());
+-				lit[Lit.birthday] = new LispString(df.format(new Date()));
++				lit[Lit.birthday] = new LispString(birthday());
+ 			}
+ 			else
+ 			{   // System.out.println("Bodge here...");
+@@ -951,6 +950,19 @@
+ 		lit[Lit.query_io].car/*value*/    = lispIO;
+ 	}
+ 
++	// The date stamped into the image, fixed by SOURCE_DATE_EPOCH when it is set
++	static String birthday()
++	{   String epoch = System.getenv("SOURCE_DATE_EPOCH");
++		if (epoch != null)
++		{   DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.ROOT);
++			df.setTimeZone(TimeZone.getTimeZone("UTC"));
++			return df.format(new Date(1000 * Long.parseLong(epoch)));
++		}
++		DateFormat df = DateFormat.getInstance();
++		df.setTimeZone(TimeZone.getDefault());
++		return df.format(new Date());
++	}
++
+         //Checkpoint calls this function.
+ 	public static void preserve(LispObject arg1, LispObject arg2) throws Exception
+ 	{
+@@ -966,10 +978,7 @@
+ 
+ 		LispObject oldBirthday = lit[Lit.birthday];
+ 		// I want the new image file to have a fresh date
+-		DateFormat df = DateFormat.getInstance();
+-		df.setTimeZone(TimeZone.getDefault());
+-		lit[Lit.birthday] =
+-		        new LispString(df.format(new Date()));
++		lit[Lit.birthday] = new LispString(birthday());
+ 
+ 		GZIPOutputStream dump = null;
+ 		try
+--- a/src/org/mathpiper/mpreduce/functions/builtin/Fns1.java
++++ b/src/org/mathpiper/mpreduce/functions/builtin/Fns1.java
+@@ -50,6 +50,8 @@
+ import java.text.ParsePosition;
+ import java.util.Date;
+ import java.util.Iterator;
++import java.util.Locale;
++import java.util.TimeZone;
+ import org.mathpiper.mpreduce.Environment;
+ 
+ import org.mathpiper.mpreduce.functions.functionwithenvironment.Bytecode;
+@@ -1598,6 +1600,12 @@
+ {
+     public LispObject op0()
+     {
++        String epoch = System.getenv("SOURCE_DATE_EPOCH");
++        if (epoch != null)
++        {   DateFormat df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.ROOT);
++            df.setTimeZone(TimeZone.getTimeZone("UTC"));
++            return new LispString(df.format(new Date(1000 * Long.parseLong(epoch))));
++        }
+         Date now = new Date();
+         String s = DateFormat.getDateTimeInstance().format(now);
+         return new LispString(s);
+--- a/src/org/mathpiper/mpreduce/packagedatastore/PDS.java
++++ b/src/org/mathpiper/mpreduce/packagedatastore/PDS.java
+@@ -399,10 +399,51 @@
+     } while (p != 0);
+ }
+ 
++// Replacing a member in place leaves its old space vacant, and the size of
++// that stale content varies from one build to another. Rewrite the file
++// without the member instead, the new version is then appended to it.
++void removeMember(String member) throws IOException, ResourceException
++{
++    Vector names = new Vector();
++    byte [] buffer = new byte[DirectoryBlockSize];
++    long p = 0;
++    do
++    {   seek(p);
++        for (int i=0; i<buffer.length; i++) buffer[i] = (byte)read();
++        p = 0;
++        for (int i=0; i<4; i++) p = (p<<8) + (buffer[i+2] & 0xff);
++        int n = 6, l;
++        while ((l = buffer[n++] & 0xff) != 0)
++        {   String nn = new String(buffer, n, l, "UTF8");
++            if (!nn.equals(member)) names.add(nn);
++            n += l + 16;
++        }
++    } while (p != 0);
++    Vector contents = new Vector();
++    for (int i=0; i<names.size(); i++)
++    {   PDSEntry e = (PDSEntry)directory.get(names.get(i));
++        byte [] b = new byte[e.len];
++        f.seek(e.loc);
++        f.readFully(b);
++        contents.add(b);
++    }
++    f.setLength(0);
++    f.close();
++    f = null;
++    directory.clear();
++    for (int i=0; i<names.size(); i++)
++    {   PDSOutputStream out = new PDSOutputStream(this, (String)names.get(i));
++        byte [] b = (byte [])contents.get(i);
++        for (int j=0; j<b.length; j++) out.write(b[j]);
++        out.close();
++    }
++}
++
+ void addToDirectory(String member) throws IOException, ResourceException
+ {
+     if (!writeable)
+         throw new IOException("Attempt to update a read-only image file");
++    if (f != null && directory.get(member) != null) removeMember(member);
+     Jlisp.println("Image member " + member + " being created");
+     long p = 0;
+     int n, i;
+--- a/src/org/mathpiper/mpreduce/packagedatastore/PDSOutputStream.java
++++ b/src/org/mathpiper/mpreduce/packagedatastore/PDSOutputStream.java
+@@ -76,7 +76,7 @@
+     pds.f.write(length >> 16);
+     pds.f.write(length >> 8);
+     pds.f.write(length);
+-    long date = new Date().getTime();
++    long date = 0;
+     pds.f.write((int)(date >> 56));
+     pds.f.write((int)(date >> 48));
+     pds.f.write((int)(date >> 40));


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,2 @@
 variableList
-reproducible
+reproducible-image



View it on GitLab: https://salsa.debian.org/java-team/mathpiper/-/compare/cdd9c5c994fe85e34426264562bb0aebaf72a1bb...b35c1e0a970e428d8cc6c4eaf42d46e8625ca298

-- 
View it on GitLab: https://salsa.debian.org/java-team/mathpiper/-/compare/cdd9c5c994fe85e34426264562bb0aebaf72a1bb...b35c1e0a970e428d8cc6c4eaf42d46e8625ca298
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/20261020/d9b276d7/attachment.htm>


More information about the pkg-java-commits mailing list