git: 09afabd9c0d7 - stable/14 - Makefile.inc1: Make package timestamps reproducible by default
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 13 Mar 2025 18:10:06 UTC
The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=09afabd9c0d7b89cd711f5de7af3f0841701abc7 commit 09afabd9c0d7b89cd711f5de7af3f0841701abc7 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2025-02-27 13:17:11 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-03-13 18:09:09 +0000 Makefile.inc1: Make package timestamps reproducible by default Set package archive timestamps based on most recent source commit timestamp (approach suggested by bapt). I'd like to include git metadata in a file included in src tarballs, so that the build is reproducible (including the hash shown in uname etc.) outside of a git checkout. There are still details to be sorted out to do that, so this is an interim step to improve reproducibility. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49165 (cherry picked from commit 8a3537aaf7c19f7331fcc160ab42e36fc79e408a) --- Makefile.inc1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index b1a882a042a6..e43b2ff2e527 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -573,8 +573,12 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g} .endif # !defined(PKG_VERSION) .if !defined(PKG_TIMESTAMP) +.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) +SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD +.else TIMEEPOCHNOW= %s SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} +.endif .else SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} .endif