Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jun 2016 14:02:59 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org
Subject:   svn commit: r48924 - head/share/mk
Message-ID:  <201606141402.u5EE2xcA059642@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606141402.u5EE2xcA059642>