The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=44a768e1a80d9e4f06d07fbd9025e63622a80de0

commit 44a768e1a80d9e4f06d07fbd9025e63622a80de0
Author:     Colin Percival <cperc...@freebsd.org>
AuthorDate: 2025-02-03 03:37:56 +0000
Commit:     Colin Percival <cperc...@freebsd.org>
CommitDate: 2025-02-03 23:58:32 +0000

    stand: Use SOURCE_DATE_EPOCH in newvers.sh
    
    The newvers.sh script is used to generate vers.c for 10 programs (at
    latest count on amd64): 4 EFI loaders, 3 x86 loaders, two userboots,
    and one kboot.  When building without MK_REPRODUCIBLE_BUILD this
    resulted in 10 different timestamps being compiled into various files.
    
    If SOURCE_DATE_EPOCH is set, use that value rather than the current
    date and time.
    
    Reviewed by:    emaste, imp
    Sponsored by:   Amazon
    Differential Revision:  https://reviews.freebsd.org/D48803
---
 stand/common/newvers.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/stand/common/newvers.sh b/stand/common/newvers.sh
index 369a1c7c76df..c244e718c041 100755
--- a/stand/common/newvers.sh
+++ b/stand/common/newvers.sh
@@ -43,7 +43,15 @@ done
 shift $((OPTIND - 1))
 
 LC_ALL=C; export LC_ALL
-u=${USER-root} h=${HOSTNAME-`hostname`} t=`date`
+u=${USER-root} h=${HOSTNAME-`hostname`}
+if [ -n "$SOURCE_DATE_EPOCH" ]; then
+       if ! t=$(date -ur $SOURCE_DATE_EPOCH 2>/dev/null); then
+               echo "Invalid SOURCE_DATE_EPOCH" >&2
+               exit 1
+       fi
+else
+       t=`date`
+fi
 r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1`
 
 bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n"

Reply via email to