From deabedb5305159f7811aea9fe7c5c945dbf779c9 Mon Sep 17 00:00:00 2001 From: Philip Rinn Date: Sun, 18 Feb 2024 19:12:24 +0100 Subject: [PATCH] Make package release dates reproducible Using `string(TIMESTAMP ...)` respects `SOURCE_DATE_EPOCH` since CMake 3.8, which makes it possible to fix the date used as release date in AppStream metadata and Fedora packaging. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bd30d60..59cd7708 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,8 @@ SET(INTERFACE_TYPE "qt5" CACHE STRING "Select interface type: qt5/qt6/gtk") MESSAGE(STATUS "${INTERFACE_TYPE} interface will be built") SET(MANUAL_DIR "share/doc/gimagereader" CACHE PATH "Path where manual will be installed") SET(ENABLE_VERSIONCHECK 1 CACHE BOOL "Enable version check") -EXECUTE_PROCESS(COMMAND date +%a\ %b\ %d\ %Y OUTPUT_VARIABLE PACKAGE_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) -EXECUTE_PROCESS(COMMAND date +%Y-%m-%d OUTPUT_VARIABLE PACKAGE_ISO_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) +string(TIMESTAMP PACKAGE_DATE "%a\ %b\ %d\ %Y" UTC) +string(TIMESTAMP PACKAGE_ISO_DATE "%Y-%m-%d" UTC) EXECUTE_PROCESS(COMMAND date -R OUTPUT_VARIABLE PACKAGE_RFC_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) EXECUTE_PROCESS(COMMAND git rev-parse HEAD OUTPUT_VARIABLE PACKAGE_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE)