release: Pass PKG_INSTALL_EPOCH to vmimage.subr

This value, if not already set, comes from the timestamp of the most
recent git commit (which is now also available in src/release code as
GITEPOCH) or 0 if git is not installed.

This should allow /var/db/pkg/local.sqlite to be reproducible in VM
images which have packages installed (e.g. cloudware).

Reviewed by:	emaste, bapt
MFC after:	5 days
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D49760
This commit is contained in:
Colin Percival 2025-04-09 23:05:55 -07:00
parent 726d4e1486
commit 81ca663642
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,3 @@
#
#
# Figure out where the git binary is.
.for _P in /usr/bin /usr/local/bin
. if !defined(GIT_CMD) || empty(GIT_CMD)
@ -24,13 +21,19 @@ GITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null ||
GITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --first-parent --count HEAD 2>/dev/null || true
. export GITCOUNT
. endif
. if !defined(GITEPOCH) || empty(GITEPOCH)
GITEPOCH!= ${GIT_CMD} -C ${.CURDIR} show -s --format=%ct HEAD 2>/dev/null || true
. export GITEPOCH
. endif
.else
GITBRANCH= nullbranch
GITREV= nullhash
GITCOUNT= nullcount
GITEPOCH= 0
. export GITBRANCH
. export GITREV
. export GITCOUNT
. export GITEPOCH
.endif
# Set the build date, primarily for snapshot builds.

View file

@ -181,6 +181,7 @@ vm-image: ${QEMUTGT}
QEMUSTATIC=${QEMUSTATIC} \
${WITHOUT_QEMU:DWITHOUT_QEMU=true} \
${NO_ROOT:DNO_ROOT=true} \
PKG_INSTALL_EPOCH=${PKG_INSTALL_EPOCH:U${GITEPOCH}} \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr \
-d ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS} -F ${FS} \