Use Subversion metadata for version information rather than grepping for

$FreeBSD$ version strings.
This commit is contained in:
Warren Block 2017-05-05 13:50:57 +00:00
parent de51814d2f
commit 53c6e4e7db
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=50233
2 changed files with 17 additions and 10 deletions

View file

@ -42,6 +42,7 @@ XARGS?= /usr/bin/xargs
# Version control
#
GIT?= /usr/local/bin/git
SVN?= /usr/local/bin/svn
#
# Compession and decompression

View file

@ -100,15 +100,21 @@ LATESTREVISION!=cd ${.CURDIR} && ${GIT} log -1 --pretty=format:'\
--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,^,\#${IDSTR1}${IDSTR2}\${.newline},' \
-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