Makefile.inc1: Conditionalize some package related variables

In particular, don't invoke git to compute SOURCE_DATE_EPOCH for
unrelated targets like check-old or delete-old.  If the git invocation
fails (e.g. when using a git worktree mounted over NFS) it can
generate a lot of irrelevant warning spam.

Reviewed by:	emaste
Fixes:		8a3537aaf7 ("Makefile.inc1: Make package timestamps reproducible by default")
Differential Revision:	https://reviews.freebsd.org/D49278

(cherry picked from commit db6f2bb93a)
This commit is contained in:
John Baldwin 2025-03-10 13:30:26 -04:00 committed by Ed Maste
parent 09afabd9c0
commit 9ca20e5ec9

View file

@ -572,6 +572,7 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g}
.endif
.endif # !defined(PKG_VERSION)
.if make(*package*)
.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
@ -589,6 +590,7 @@ PKG_WWW?= https://www.FreeBSD.org
.export PKG_NAME_PREFIX
.export PKG_MAINTAINER
.export PKG_WWW
.endif
.if !defined(_MKSHOWCONFIG)
_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \