svn commit: r322412 - in head: . release/packages share/mk
Glen Barber
gjb at FreeBSD.org
Fri Aug 11 19:21:42 UTC 2017
Author: gjb
Date: Fri Aug 11 19:21:40 2017
New Revision: 322412
URL: https://svnweb.freebsd.org/changeset/base/322412
Log:
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
Modified:
head/Makefile.inc1
head/release/packages/kernel.ucl
head/release/packages/runtime.ucl
head/share/mk/bsd.own.mk
Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1 Fri Aug 11 19:02:11 2017 (r322411)
+++ head/Makefile.inc1 Fri Aug 11 19:21:40 2017 (r322412)
@@ -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,^""$,${_defaul
-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,^""$,${_
-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\" ' \
Modified: head/release/packages/kernel.ucl
==============================================================================
--- head/release/packages/kernel.ucl Fri Aug 11 19:02:11 2017 (r322411)
+++ head/release/packages/kernel.ucl Fri Aug 11 19:21:40 2017 (r322412)
@@ -5,7 +5,7 @@
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
-comment = "%COMMENT%"
+comment = "%COMMENT% %VCS_REVISION%"
categories = [ base ]
maintainer = "re at FreeBSD.org"
www = "https://www.FreeBSD.org"
Modified: head/release/packages/runtime.ucl
==============================================================================
--- head/release/packages/runtime.ucl Fri Aug 11 19:02:11 2017 (r322411)
+++ head/release/packages/runtime.ucl Fri Aug 11 19:21:40 2017 (r322412)
@@ -5,7 +5,7 @@
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
-comment = "%COMMENT%"
+comment = "%COMMENT% %VCS_REVISION%"
categories = [ base ]
maintainer = "re at FreeBSD.org"
www = "https://www.FreeBSD.org"
Modified: head/share/mk/bsd.own.mk
==============================================================================
--- head/share/mk/bsd.own.mk Fri Aug 11 19:02:11 2017 (r322411)
+++ head/share/mk/bsd.own.mk Fri Aug 11 19:21:40 2017 (r322412)
@@ -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
More information about the svn-src-all
mailing list