diff --git a/Makefile.inc1 b/Makefile.inc1 index 95e55ac45a8a..7aeca8b517b3 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -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\" ' \ diff --git a/release/packages/kernel.ucl b/release/packages/kernel.ucl index 487e03456d21..1df0de07a196 100644 --- a/release/packages/kernel.ucl +++ b/release/packages/kernel.ucl @@ -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" diff --git a/release/packages/runtime.ucl b/release/packages/runtime.ucl index 4d7d0fc14f60..b819be14f758 100644 --- a/release/packages/runtime.ucl +++ b/release/packages/runtime.ucl @@ -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" diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index fd4ba874c596..cb94b8f96e7d 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -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