svn commit: r50233 - head/share/mk

Warren Block <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
Author: wblock
Date: Fri May  5 13:50:57 2017
New Revision: 50233
URL: https://svnweb.freebsd.org/changeset/doc/50233

Log:
  Use Subversion metadata for version information rather than grepping for
  $FreeBSD$ version strings.

Modified:
  head/share/mk/doc.commands.mk
  head/share/mk/doc.docbook.mk

Modified: head/share/mk/doc.commands.mk
==============================================================================
--- head/share/mk/doc.commands.mk	Fri May  5 10:33:47 2017	(r50232)
+++ head/share/mk/doc.commands.mk	Fri May  5 13:50:57 2017	(r50233)
@@ -42,6 +42,7 @@ XARGS?=		/usr/bin/xargs
 # Version control
 #
 GIT?=		/usr/local/bin/git
+SVN?=		/usr/local/bin/svn
 
 #
 # Compession and decompression

Modified: head/share/mk/doc.docbook.mk
==============================================================================
--- head/share/mk/doc.docbook.mk	Fri May  5 10:33:47 2017	(r50232)
+++ head/share/mk/doc.docbook.mk	Fri May  5 13:50:57 2017	(r50233)
@@ -100,15 +100,21 @@ LATESTREVISION!=cd ${.CURDIR} && ${GIT} 
 	--stringparam latestrevision.committer "%cn" \
 	--stringparam latestrevision.number "%h"' ${SRCS}
 .else
-# version numbers are expected to be in Subversion, but we cannot
-# require Subversion to be installed just to build the documents,
-# so use grep to find the version strings
-LATESTREVISION!=${GREP} -Ehos '\$$[F]reeBSD: ([^\$$ ]+ ){5}\$$' ${SRCS} | \
-		${AWK} '{ print \
-		  "--stringparam latestrevision.timestamp \""$$4" "$$5"\" " \
-		  "--stringparam latestrevision.committer \""$$6"\" " \
-		  "--stringparam latestrevision.number \""$$3"\" " \
-		}' | ${SORT} | ${TAIL} -n1
+# if using Subversion, get information from metadata
+# rather than embedded version strings
+.if exists(${DOC_PREFIX}/.svn) && exists(${SVN})
+LATESTREVISION!=cd ${.CURDIR} && ${SVN} info ${SRCS} 2>/dev/null | \
+		${AWK} 'BEGIN {	genfmt="--stringparam latestrevision."; \
+				timefmt=genfmt"timestamp \"%s %s\""; \
+				comtfmt=genfmt"committer \"%s\""; \
+				revnfmt=genfmt"number \"%u\""; \
+				fmt=timefmt" "comtfmt"\t\t"revnfmt"\n"; } \
+			/^Last Changed Author:/ { committer=$$4 } \
+		        /^Last Changed Rev:/    { number=$$4 } \
+		        /^Last Changed Date:/   { date=$$4; time=$$5; \
+				printf(fmt, date, time, committer, number) }' \
+		| ${SORT} | ${TAIL} -n1
+.endif
 .endif
 
 # if neither Subversion nor Git revision numbers are available, use
@@ -336,7 +342,7 @@ POSET_CMD=	${SED} -i '' -e '1s,^,\#${IDS
 			     -e 's,^\(\"Language-Team:.*\\n\"\),\1\${.newline}\"Language: ${PO_LANG}\\n\",' \
 			     -e 's,^\"Content-Type: text/plain; charset=.*\\n,\"Content-Type: text/plain; charset=${PO_CHARSET}\\n,'
 
-.if ${.TARGETS:Mpo} || ${.TARGETS:Mtran}
+.if ${.TARGETS:Mpo} || ${.TARGETS:Mtran} || ${.TARGETS:M${DOC}.translate.xml}
 
 MASTER_SRCS!=	${MAKE} -C ${EN_DIR} -V SRCS
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.