Source: ectrans
Severity: normal
Tags: patch
User: [email protected]
Usertags: timestamps kernel
X-Debbugs-Cc: [email protected]

The timestamp and kernel version is embedded in /usr/bin/ectrans:
  
  
https://tests.reproducible-builds.org/debian/rb-pkg/bookworm/amd64/diffoscope-results/ectrans.html

  echo·"··timestamp·······:·20240111001706"
  vs.
  echo·"··timestamp·······:·20221209195542"

  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 ectrans 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 ectrans!


live well,
  vagrant
From 8807b944d1f770f44304586ddc57a99e9900bc3d Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Fri, 20 Jan 2023 01:20:29 +0000
Subject: [PATCH 1/2] src/programs/ectrans.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/ectrans.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/programs/ectrans.in b/src/programs/ectrans.in
index a80893d..4d28884 100755
--- a/src/programs/ectrans.in
+++ b/src/programs/ectrans.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 337d2242cfa3b168ce998f1d3747cc5e4c18ce65 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Fri, 20 Jan 2023 01:19:06 +0000
Subject: [PATCH 2/2] Pass BUILD_TIMESTAMP via CMakeLists.txt and use in
 ectrans.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/ectrans.in     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/programs/CMakeLists.txt b/src/programs/CMakeLists.txt
index b7cdc1f..74755b1 100644
--- a/src/programs/CMakeLists.txt
+++ b/src/programs/CMakeLists.txt
@@ -50,6 +50,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( ectrans.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/ectrans @ONLY )
 
 file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/ectrans
diff --git a/src/programs/ectrans.in b/src/programs/ectrans.in
index 4d28884..ba52641 100755
--- a/src/programs/ectrans.in
+++ b/src/programs/ectrans.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