Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include

svnversion metadata to the runtime and kernel packages.

Instead of traversing src/sys, as is done by newvers.sh for uname(1),
a full tree walk is done to prevent userland and/or modifications
from not being reflected in a modified tree (M).

MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2017-08-11 19:21:40 +00:00
parent c82d887d47
commit ebd2eeb3f8
4 changed files with 23 additions and 3 deletions

View File

@ -346,6 +346,12 @@ SVN= ${_P}/${_S}
. endfor
.endif
SVNFLAGS?= -r HEAD
.if !defined(VCS_REVISION) && empty(VCS_REVISION)
_VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR})
. if !empty(_VCS_REVISION)
VCS_REVISION= $$(echo r${_VCS_REVISION})
. endif
.endif
.if !defined(OSRELDATE)
.if exists(/usr/include/osreldate.h)
@ -1626,9 +1632,10 @@ create-world-package-${pkgname}: .PHONY
@awk -F\" ' \
/^name/ { printf("===> Creating %s-", $$2); next } \
/^version/ { print $$2; next } \
' ${WSTAGEDIR}/${pkgname}.ucl ;
' ${WSTAGEDIR}/${pkgname}.ucl
@if [ "${pkgname}" == "runtime" ]; then \
sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
fi
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
create -M ${WSTAGEDIR}/${pkgname}.ucl \
@ -1658,6 +1665,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap
-e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \
-e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
-e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
${SRCDIR}/release/packages/kernel.ucl \
> ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
awk -F\" ' \
@ -1692,6 +1700,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kerne
-e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \
-e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
-e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
${SRCDIR}/release/packages/kernel.ucl \
> ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
awk -F\" ' \

View File

@ -5,7 +5,7 @@
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
comment = "%COMMENT%"
comment = "%COMMENT% %VCS_REVISION%"
categories = [ base ]
maintainer = "re@FreeBSD.org"
www = "https://www.FreeBSD.org"

View File

@ -5,7 +5,7 @@
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
comment = "%COMMENT%"
comment = "%COMMENT% %VCS_REVISION%"
categories = [ base ]
maintainer = "re@FreeBSD.org"
www = "https://www.FreeBSD.org"

View File

@ -233,6 +233,17 @@ XZ_CMD?= xz -T ${XZ_THREADS}
XZ_CMD?= xz
.endif
.if !defined(SVNVERSION_CMD) && empty(SVNVERSION_CMD)
. for _D in ${PATH:S,:, ,g}
. if exists(${_D}/svnversion)
SVNVERSION_CMD?=${_D}/svnversion
. endif
. if exists(${_D}/svnliteversion)
SVNVERSION_CMD?=${_D}/svnliteversion
. endif
. endfor
.endif
PKG_CMD?= pkg
# Pointer to the top directory into which tests are installed. Should not be