Subject: [PATCH] Use SOURCE_DATE_EPOCH for GASNETI_BUILD_ID when available

From: Jochen Sprickerhof <[email-masked]>
Date: Sun, 5 Jul 2026 13:39:25 +0200

---
 debian/patches/reproducibility.patch | 56 ++++++++++++++++++----------
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/debian/patches/reproducibility.patch b/debian/patches/reproducibility.patch
index beeb467..53ab04c 100644
--- a/debian/patches/reproducibility.patch
+++ b/debian/patches/reproducibility.patch
@@ -1,31 +1,52 @@
 Description: Don't include timestamp; it breaks reproducible builds
 Author: Alastair McKinstry <[email-masked]>
-Last-Updated: 2026-06-01
+Last-Updated: 2026-07-05
 Forwarded: not-needed
 
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -1030,7 +1030,11 @@
+       BUILD_USER="$USER"
+     fi
+   fi
+-  BUILD_ID="`date` $BUILD_USER"
++  if test -n "$SOURCE_DATE_EPOCH"; then
++    BUILD_ID="`date -d @$SOURCE_DATE_EPOCH` $BUILD_USER"
++  else
++    BUILD_ID="`date` $BUILD_USER"
++  fi
+   AC_MSG_RESULT( build id:       $BUILD_ID)
+   AC_SUBST(BUILD_ID)
+ 
+--- a/configure
++++ b/configure
+@@ -6084,7 +6084,11 @@
+       BUILD_USER="$USER"
+     fi
+   fi
+-  BUILD_ID="`date` $BUILD_USER"
++  if test -n "$SOURCE_DATE_EPOCH"; then
++    BUILD_ID="`date -d @$SOURCE_DATE_EPOCH` $BUILD_USER"
++  else
++    BUILD_ID="`date` $BUILD_USER"
++  fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: build id:       $BUILD_ID" >&5
+ $as_echo "build id:       $BUILD_ID" >&6; }
+ 
 --- a/gasnet_trace.c
 +++ b/gasnet_trace.c
-@@ -953,9 +953,9 @@
+@@ -953,7 +953,7 @@
    }
  
    gasneti_tracestats_printf("GASNET_CONFIG_STRING: %s", GASNET_CONFIG_STRING);
 -  gasneti_tracestats_printf("GASNet build timestamp:   " __DATE__ " " __TIME__);
 +  // gasneti_tracestats_printf("GASNet build timestamp:   " __DATE__ " " __TIME__);
    gasneti_tracestats_printf("GASNet configure args:    %s", GASNETI_CONFIGURE_ARGS);
--  gasneti_tracestats_printf("GASNet configure buildid: " GASNETI_BUILD_ID);
-+  // gasneti_tracestats_printf("GASNet configure buildid: " GASNETI_BUILD_ID);
+   gasneti_tracestats_printf("GASNet configure buildid: " GASNETI_BUILD_ID);
    gasneti_tracestats_printf("GASNet system tuple:      " GASNETI_SYSTEM_TUPLE);
-   gasneti_tracestats_printf("GASNet configure system:  " GASNETI_SYSTEM_NAME);
-   gasneti_tracestats_printf("gex_System_QueryJobRank(): %i", (int)gex_System_QueryJobRank());
 --- a/gasnet_tools.c
 +++ b/gasnet_tools.c
-@@ -1,4 +1,4 @@
--/*   $Source: bitbucket.org:berkeleylab/gasnet.git/gasnet_tools.c $
-+/*   $Source: bitbucket.org:berkeleylab/gasnet.git/gasnet_tools.c $
-  * Description: GASNet implementation of internal helpers
-  * Copyright 2002, Dan Bonachea <[email-masked]>
-  * Terms of use are as specified in license.txt
-@@ -385,11 +385,11 @@
+@@ -385,8 +385,8 @@
  
  GASNETI_IDENT(gasnett_IdentString_Config, "$GASNetToolsConfig: " GASNETT_CONFIG_STRING " $");
  
@@ -34,10 +55,5 @@ Forwarded: not-needed
 +//GASNETI_IDENT(gasnett_IdentString_BuildTimestamp, 
 +//             "$GASNetBuildTimestamp: " __DATE__ " " __TIME__ " $");
  
--GASNETI_IDENT(gasnett_IdentString_BuildID, 
--             "$GASNetBuildId: " GASNETI_BUILD_ID " $");
-+//GASNETI_IDENT(gasnett_IdentString_BuildID, 
-+//             "$GASNetBuildId: " GASNETI_BUILD_ID " $");
- GASNETI_IDENT(gasnett_IdentString_ConfigureArgs, 
-              "$GASNetConfigureArgs: " GASNETI_CONFIGURE_ARGS " $");
- GASNETI_IDENT(gasnett_IdentString_SystemTuple, 
+ GASNETI_IDENT(gasnett_IdentString_BuildID, 
+              "$GASNetBuildId: " GASNETI_BUILD_ID " $");
-- 
2.53.0