svn commit: r254094 - head/sys/conf
Glen Barber
gjb at FreeBSD.org
Thu Aug 8 15:59:01 UTC 2013
Author: gjb
Date: Thu Aug 8 15:59:00 2013
New Revision: 254094
URL: http://svnweb.freebsd.org/changeset/base/254094
Log:
When newvers.sh is run, it is possible that the svnversion
(or svnliteversion) in the current lookup path is not what
was used to check out the tree. If an incompatible version
is used, the svn revision number is not reported in uname(1).
Run ${svnversion} on newvers.sh itself when evaluating if the
svn(1) in use is compatible with the tree. Fallback to an
empty ${svnversion} if necessary.
With this change, svnliteversion from base is only used
if no compatible svnversion is found, so with this change,
the version of svn(1) from the ports tree is evaluated first.
Requested by: many
MFC after: 3 days
X-MFC-To: stable/9, releng/9.2 only
Modified:
head/sys/conf/newvers.sh
Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh Thu Aug 8 11:53:47 2013 (r254093)
+++ head/sys/conf/newvers.sh Thu Aug 8 15:59:00 2013 (r254094)
@@ -88,19 +88,31 @@ v=`cat version` u=${USER:-root} d=`pwd`
i=`${MAKE:-make} -V KERN_IDENT`
compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version')
-if [ -x /usr/bin/svnliteversion ] ; then
- svnversion=/usr/bin/svnliteversion
-fi
-
for dir in /usr/bin /usr/local/bin; do
if [ ! -z "${svnversion}" ] ; then
break
fi
if [ -x "${dir}/svnversion" ] && [ -z ${svnversion} ] ; then
- svnversion=${dir}/svnversion
- break
+ # Run svnversion from ${dir} on this script; if return code
+ # is not zero, the checkout might not be compatible with the
+ # svnversion being used.
+ ${dir}/svnversion $(basename ${0}) >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ svnversion=${dir}/svnversion
+ break
+ fi
fi
done
+
+if [ -z "${svnversion}" ] && [ -x /usr/bin/svnliteversion ] ; then
+ /usr/bin/svnversion $(basename ${0}) >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ svnversion=/usr/bin/svnliteversion
+ else
+ svnversion=
+ fi
+fi
+
for dir in /usr/bin /usr/local/bin; do
if [ -x "${dir}/p4" ] && [ -z ${p4_cmd} ] ; then
p4_cmd=${dir}/p4
More information about the svn-src-head
mailing list