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

The timestamp and kernel version is embedded in /usr/bin/fiat:

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

  echo·"··timestamp·······:·20240111001119"
  vs.
  echo·"··timestamp·······:·20221209195227"

  echo·"··op.·system······:·Linux-6.0.0-0.deb11.2-amd64·(linux.64)"
  vs.
  echo·"··op.·system······:·Linux-5.10.0-19-amd64·(linux.64)"

The attached two patches fix this by using CMAKE_SYSTEM_NAME instead of
CMAKE_SYSTEM, and using CMake's timestamp function for the build date,
which supports a consistent timestamp if the SOURCE_DATE_EPOCH
environment variable is set.

According to my local tests, with these patches applied fiat-ecmwf should
build reproducibly on tests.reproducible-builds.org once the package
migrates to bookworm/testing!

Unfortunately, there are other outstanding issues with build paths,
which are tested in unstable and experimental.

Thanks for maintaining fiat-ecmwf!

live well,
  vagrant
From fa4c73e2d8875eea58af026485b508461c657f42 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Fri, 20 Jan 2023 22:50:55 +0000
Subject: [PATCH 1/2] src/programs/fiat.in: Avoid embedding the running kernel
 version.

Use CMAKE_SYSTEM_NAME instead of CMAKE_SYSTEM to avoid embedding the
running kernel version.

https://tests.reproducible-builds.org/debian/issues/bookworm/captures_kernel_version_via_CMAKE_SYSTEM_issue.html
---
 src/programs/fiat.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/programs/fiat.in b/src/programs/fiat.in
index 86f52eb..cab504c 100755
--- a/src/programs/fiat.in
+++ b/src/programs/fiat.in
@@ -42,7 +42,7 @@ info()
   echo "Build:"
   echo "  build type      : @CMAKE_BUILD_TYPE@"
   echo "  timestamp       : @EC_BUILD_TIMESTAMP@"
-  echo "  op. system      : @CMAKE_SYSTEM@ (@EC_OS_NAME@.@EC_OS_BITS@)"
+  echo "  op. system      : @CMAKE_SYSTEM_NAME@ (@EC_OS_NAME@.@EC_OS_BITS@)"
   echo "  processor       : @CMAKE_SYSTEM_PROCESSOR@"
   echo "  c compiler      : @CMAKE_C_COMPILER_ID@ @CMAKE_C_COMPILER_VERSION@"
   echo "    flags         : @EC_C_FLAGS@"
-- 
2.39.0

From 470c9ba8160be203eba1a43b208596e4b9abc1c8 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Fri, 20 Jan 2023 22:53:19 +0000
Subject: [PATCH 2/2] Pass BUILD_TIMESTAMP via CMakeLists.txt and use in
 fiat.in for the build timestamp.

The CMake TIMESTAMP function respects SOURCE_DATE_EPOCH when
specifying UTC timezone.

https://reproducible-builds.org/docs/timestamps/
---
 src/programs/CMakeLists.txt | 1 +
 src/programs/fiat.in        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/programs/CMakeLists.txt b/src/programs/CMakeLists.txt
index 6a96196..2f1188e 100644
--- a/src/programs/CMakeLists.txt
+++ b/src/programs/CMakeLists.txt
@@ -16,6 +16,7 @@ foreach( lang ${langs} )
   set( EC_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} ${CMAKE_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
 endforeach()
 
+string(TIMESTAMP BUILD_TIMESTAMP "%Y%m%d%H%M%S" UTC)
 configure_file( ${tool}.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${tool} @ONLY )
 
 file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${tool}
diff --git a/src/programs/fiat.in b/src/programs/fiat.in
index cab504c..707e385 100755
--- a/src/programs/fiat.in
+++ b/src/programs/fiat.in
@@ -41,7 +41,7 @@ info()
   echo ""
   echo "Build:"
   echo "  build type      : @CMAKE_BUILD_TYPE@"
-  echo "  timestamp       : @EC_BUILD_TIMESTAMP@"
+  echo "  timestamp       : @BUILD_TIMESTAMP@"
   echo "  op. system      : @CMAKE_SYSTEM_NAME@ (@EC_OS_NAME@.@EC_OS_BITS@)"
   echo "  processor       : @CMAKE_SYSTEM_PROCESSOR@"
   echo "  c compiler      : @CMAKE_C_COMPILER_ID@ @CMAKE_C_COMPILER_VERSION@"
-- 
2.39.0

Attachment: signature.asc
Description: PGP signature

Reply via email to