[PATCH cygport] Modify origsrc timestamp in patch files if SOURCE_DATE_EPOCH is used

Christian Franke Christian.Franke@t-online.de
Wed Feb 28 15:54:47 GMT 2024


Found during testing of 'repro-check' patch with getent-2.18.90-5 source 
package.

This patch also removes the requirement to set TZ=UTC before patches are 
generated.

-- 
Regards,
Christian

-------------- next part --------------
From 342ff5113499a83b2ffda441ddc80b4952b400f8 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Wed, 28 Feb 2024 16:46:51 +0100
Subject: [PATCH] Modify origsrc timestamp in patch files if SOURCE_DATE_EPOCH
 is used

Also the timestamp of a file in origsrc directory may be newer than
SOURCE_DATE_EPOCH if modified after unpacking e.g. by a src_*_hook.
---
 lib/pkg_pkg.cygpart | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 756a687c..414ec4b4 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -508,9 +508,9 @@ __pkg_diff() {
 
 	if [ -n "${SOURCE_DATE_EPOCH}" ]
 	then
-		# Ensure that the timestamp comment in the generated patch file is reproducible
+		# Ensure that the timestamp comments in the patch files are reproducible
 		source_date=$(date -d @"${SOURCE_DATE_EPOCH}" -u +'%Y-%m-%d %H:%M:%S.000000000 +0000')
-		sed -b -e  "s|^\(+++ [^\t]*\t\).*\$|\1${source_date}|" \
+		sed -E -b -e "s/^((---|\+\+\+) [^\t]*\t).*\$/\1${source_date}/" \
 			-i ${optional_patchfiles} ${patchdir}/${src_patchfile}
 	fi
 
-- 
2.43.0



More information about the Cygwin-apps mailing list