mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
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
47 lines
1.3 KiB
Text
47 lines
1.3 KiB
Text
# Figure out where the git binary is.
|
|
.for _P in /usr/bin /usr/local/bin
|
|
. if !defined(GIT_CMD) || empty(GIT_CMD)
|
|
. if exists(${_P}/git)
|
|
GIT_CMD= ${_P}/git
|
|
. endif
|
|
. endif
|
|
.endfor
|
|
|
|
.if !empty(GIT_CMD) && exists(${GIT_CMD})
|
|
# Set the git branch and hash to export where needed.
|
|
. if !defined(GITBRANCH) || empty(GITBRANCH)
|
|
GITBRANCH!= ${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///'
|
|
. export GITBRANCH
|
|
. endif
|
|
. if !defined(GITREV) || empty(GITREV)
|
|
GITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true
|
|
. export GITREV
|
|
. endif
|
|
. if !defined(GITCOUNT) || empty(GITCOUNT)
|
|
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.
|
|
.if !defined(BUILDDATE) || empty(BUILDDATE)
|
|
BUILDDATE!= date +%Y%m%d
|
|
.export BUILDDATE
|
|
.endif
|
|
|
|
# Override UNAME_r to allow building ports for a different branch.
|
|
UNAME_r= ${REVISION}-${BRANCH}
|
|
.export UNAME_r
|