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 # Version control
# #
GIT?= /usr/local/bin/git GIT?= /usr/local/bin/git
SVN?= /usr/local/bin/svn
# #
# Compession and decompression # Compession and decompression

View file

@ -100,15 +100,21 @@ LATESTREVISION!=cd ${.CURDIR} && ${GIT} log -1 --pretty=format:'\
--stringparam latestrevision.committer "%cn" \ --stringparam latestrevision.committer "%cn" \
--stringparam latestrevision.number "%h"' ${SRCS} --stringparam latestrevision.number "%h"' ${SRCS}
.else .else
# version numbers are expected to be in Subversion, but we cannot # if using Subversion, get information from metadata
# require Subversion to be installed just to build the documents, # rather than embedded version strings
# so use grep to find the version strings .if exists(${DOC_PREFIX}/.svn) && exists(${SVN})
LATESTREVISION!=${GREP} -Ehos '\$$[F]reeBSD: ([^\$$ ]+ ){5}\$$' ${SRCS} | \ LATESTREVISION!=cd ${.CURDIR} && ${SVN} info ${SRCS} 2>/dev/null | \
${AWK} '{ print \ ${AWK} 'BEGIN { genfmt="--stringparam latestrevision."; \
"--stringparam latestrevision.timestamp \""$$4" "$$5"\" " \ timefmt=genfmt"timestamp \"%s %s\""; \
"--stringparam latestrevision.committer \""$$6"\" " \ comtfmt=genfmt"committer \"%s\""; \
"--stringparam latestrevision.number \""$$3"\" " \ revnfmt=genfmt"number \"%u\""; \
}' | ${SORT} | ${TAIL} -n1 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 .endif
# if neither Subversion nor Git revision numbers are available, use # 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,^\(\"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,' -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 MASTER_SRCS!= ${MAKE} -C ${EN_DIR} -V SRCS