svn commit: r48924 - head/share/mk
Mathieu Arnold
mat at FreeBSD.org
Tue Jun 14 14:03:00 UTC 2016
Author: mat
Date: Tue Jun 14 14:02:59 2016
New Revision: 48924
URL: https://svnweb.freebsd.org/changeset/doc/48924
Log:
Fix using LATESTREVISION when not using svn (or svn is broken)
Kinda ok'ed by: wblock
Sponsored by: Absolight
Modified:
head/share/mk/doc.docbook.mk
Modified: head/share/mk/doc.docbook.mk
==============================================================================
--- head/share/mk/doc.docbook.mk Mon Jun 13 19:03:06 2016 (r48923)
+++ head/share/mk/doc.docbook.mk Tue Jun 14 14:02:59 2016 (r48924)
@@ -87,12 +87,35 @@ NO_SUBDIR= YES
#
# Determine latest revision
#
+# This needs to contain all of:
+# --param latestrevision.timestamp "'timestamp'"
+# --param latestrevision.committer "'committer'"
+# --param latestrevision.number "'revision id'"
+
+# If using git, use git log. The revision won't work with the generated links,
+# because it is a hash, and git log doesn't know about git svn find-rev.
+.if exists(${DOC_PREFIX}/.git)
+LATESTREVISION!=cd ${.CURDIR} && git log -1 \
+ --pretty=format:'--param latestrevision.timestamp "'\''%ci'\''" --param latestrevision.committer "'\''%cn'\''" --param latestrevision.number "'\''%h'\''"' \
+ ${SRCS}
+.else
+# svn doesn't allow multiple files passed to it, so try to get the latest with grep
LATESTREVISION!=${GREP} -Ehos '\$$[F]reeBSD: ([^\$$ ]+ ){5}\$$' ${SRCS} | \
${AWK} '{ print \
" --param latestrevision.timestamp \"'\''"$$4" "$$5"'\''\"" \
" --param latestrevision.committer \"'\''"$$6"'\''\"" \
" --param latestrevision.number \"'\''"$$3"'\''\"" \
}' | ${SORT} | ${TAIL} -n1
+.endif
+
+# And sometime, strange things happen, so let's try to be a bit clever so that
+# we always have something to output, so use file on the file modified last,
+# and use its changed timestamp, user. Leave the revision as blank.
+.if empty(LATESTREVISION)
+LATESTREVISION!=stat -t '%F %T %Z' \
+ -f '--param latestrevision.timestamp "'\''%Sc'\''" --param latestrevision.committer "'\''%Su'\''" --param latestrevision.number "'\'''\''"' \
+ $(ls -t1 ${SRCS}|head -1)
+.endif
XSLTPROCOPTS+= ${LATESTREVISION}
More information about the svn-doc-head
mailing list