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

The build timestamp is embedded in /usr/include/xrt/version.h and
various binaries that make use of this include file:

  
https://tests.reproducible-builds.org/debian/rb-pkg/experimental/amd64/diffoscope-results/xrt.html

  
static·const·char·xrt_build_version_date_rfc[]·=·"Thu,·10·Mar·2022·00:03:39·-1200";
  vs.
  
static·const·char·xrt_build_version_date_rfc[]·=·"Thu,·13·Apr·2023·08:35:26·+1400";
         
  static·const·char·xrt_build_version_date[]·=·"2022-01-19·15:01:01";
  vs.
  static·const·char·xrt_build_version_date[]·=·"2022-01-20·17:01:01";


The attached patch fixes this by using cmake's TIMESTAMP feature for
both, and passing the UTC argument for both strings.


With this patch applied, xrt should build reproducibly on
tests.reproducible-builds.org once it migrates to bookworm/testing!

In unstable and experimental, it is additionally affected by varied
build paths.


Thanks for maintaining xrt!


live well,
  vagrant
From cba92515b6c76f93d792cb0ae246617e4900e42a Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Sat, 12 Mar 2022 21:19:21 +0000
Subject: [PATCH] src/CMake/version.cmake: Consistently use UTC timezone for
 timestamps.

While cmake TIMESTAMP respects the SOURCE_DATE_EPOCH environment
variable, it needs to be specified in the UTC timezone otherwise the
local timezone is used.

Convert XRT_DATE_RFC to use cmake TIMESTAMP.

https://reproducible-builds.org/docs/source-date-epoch/
---
 src/CMake/version.cmake | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/CMake/version.cmake b/src/CMake/version.cmake
index b74d30f..64efdba 100644
--- a/src/CMake/version.cmake
+++ b/src/CMake/version.cmake
@@ -33,15 +33,9 @@ execute_process(
 string(REPLACE "\n" "," XRT_MODIFIED_FILES "${XRT_MODIFIED_FILES}")
 
 # Get the build date RFC format
-execute_process(
-  COMMAND date -R
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-  OUTPUT_VARIABLE XRT_DATE_RFC
-  OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
+string(TIMESTAMP XRT_DATE_RFC "%a, %d %b %Y %H:%M:%S %Z" UTC)
 
-string(TIMESTAMP XRT_DATE "%Y-%m-%d %H:%M:%S")
+string(TIMESTAMP XRT_DATE "%Y-%m-%d %H:%M:%S" UTC)
 
 
 configure_file(
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature

Reply via email to