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 . endfor
.endif .endif
SVNFLAGS?= -r HEAD 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 !defined(OSRELDATE)
.if exists(/usr/include/osreldate.h) .if exists(/usr/include/osreldate.h)
@ -1626,9 +1632,10 @@ create-world-package-${pkgname}: .PHONY
@awk -F\" ' \ @awk -F\" ' \
/^name/ { printf("===> Creating %s-", $$2); next } \ /^name/ { printf("===> Creating %s-", $$2); next } \
/^version/ { print $$2; next } \ /^version/ { print $$2; next } \
' ${WSTAGEDIR}/${pkgname}.ucl ; ' ${WSTAGEDIR}/${pkgname}.ucl
@if [ "${pkgname}" == "runtime" ]; then \ @if [ "${pkgname}" == "runtime" ]; then \
sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
fi fi
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
create -M ${WSTAGEDIR}/${pkgname}.ucl \ 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/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \
-e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
-e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
${SRCDIR}/release/packages/kernel.ucl \ ${SRCDIR}/release/packages/kernel.ucl \
> ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
awk -F\" ' \ 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/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \
-e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
-e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
${SRCDIR}/release/packages/kernel.ucl \ ${SRCDIR}/release/packages/kernel.ucl \
> ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
awk -F\" ' \ awk -F\" ' \

View File

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

View File

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

View File

@ -233,6 +233,17 @@ XZ_CMD?= xz -T ${XZ_THREADS}
XZ_CMD?= xz XZ_CMD?= xz
.endif .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 PKG_CMD?= pkg
# Pointer to the top directory into which tests are installed. Should not be # Pointer to the top directory into which tests are installed. Should not be