summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2013-08-08 15:59:00 +0000
committergjb <gjb@FreeBSD.org>2013-08-08 15:59:00 +0000
commita9f5589a92d440ca845506369a6a7ae7c1ceb3b9 (patch)
treea6f6346e04c005749e0ae0603b469f7c29778de7
parent8bff628d3a60d6a6f3d9a43e1eb4447d8a4ee084 (diff)
downloadFreeBSD-src-a9f5589a92d440ca845506369a6a7ae7c1ceb3b9.zip
FreeBSD-src-a9f5589a92d440ca845506369a6a7ae7c1ceb3b9.tar.gz
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
-rw-r--r--sys/conf/newvers.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index c16ab0d..68f3b9c 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -88,19 +88,31 @@ v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
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
OpenPOWER on IntegriCloud