From 7f582d62946fcb13caa0fb013dc0826addabcf6d Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Mon, 19 Dec 2016 17:31:34 +0000 Subject: [PATCH] newvers.sh: consider as modified SVN mixed revision and other cases The newvers -R option is intended to include build metadata (e.g. user, host, time) if the build is from an unmodified VCS tree. For subversion it considered a trailing 'M' as an indication of a modified tree, and any other version string as modified. Also include mixed revision checkouts (e.g. 123:126), switched (123S) and partial (123P) working copies as modified: the revision number is insufficient to uniquely determine which source was used for the build. Reported by: gjb Reviewed by: gjb MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8853 --- sys/conf/newvers.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 202006d0ade3..c6edddcef4b1 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -197,12 +197,17 @@ fi if [ -n "$svnversion" ] ; then svn=`cd ${SYSDIR} && $svnversion 2>/dev/null` - if expr "$svn" : ".*M" >/dev/null; then - modified=true - fi case "$svn" in - [0-9]*) svn=" r${svn}" ;; - *) unset svn ;; + [0-9]*[MSP]|*:*) + svn=" r${svn}" + modified=true + ;; + [0-9]*) + svn=" r${svn}" + ;; + *) + unset svn + ;; esac fi @@ -270,7 +275,7 @@ if [ -n "$hg_cmd" ] ; then fi include_metadata=true -while getopts r opt; do +while getopts rR opt; do case "$opt" in r) include_metadata=