Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2009 05:45:38 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r196435 - head/sys/conf
Message-ID:  <200908230545.n7N5jcpZ047952@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Sun Aug 23 05:45:38 2009
New Revision: 196435
URL: http://svn.freebsd.org/changeset/base/196435

Log:
  The svnversion string is only relevant when newvers.sh is called
  during the kernel build process, the other places that call the script
  do not make use of that information. So restrict execution of the
  svnversion-related code to the kernel build context.

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Sun Aug 23 05:42:50 2009	(r196434)
+++ head/sys/conf/newvers.sh	Sun Aug 23 05:45:38 2009	(r196435)
@@ -87,29 +87,25 @@ touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
-for dir in /bin /usr/bin /usr/local/bin; do
-	if [ -x "${dir}/svnversion" ]; then
-		svnversion=${dir}/svnversion
-		SRCDIR=${d##*obj}
-		if [ -n "$MACHINE" ]; then
-			SRCDIR=${SRCDIR##/$MACHINE}
+case "$d" in
+*/sys/*)
+	for dir in /bin /usr/bin /usr/local/bin; do
+		if [ -x "${dir}/svnversion" ]; then
+			svnversion=${dir}/svnversion
+			SRCDIR=${d##*obj}
+			if [ -n "$MACHINE" ]; then
+				SRCDIR=${SRCDIR##/$MACHINE}
+			fi
+			SRCDIR=${SRCDIR%%/sys/*}
+			break
 		fi
-		SRCDIR=${SRCDIR%%/sys/*}
-		break
-	fi
-done
+	done
 
-if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then
-	# If we are called from the kernel build, limit
-	# the scope of svnversion to sys/ .
-	if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then
-		svn=" r`cd $SRCDIR/sys && $svnversion`"
-	else
-		svn=" r`cd $SRCDIR && $svnversion`"
+	if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then
+		svn=" r`cd ${SRCDIR}/sys && $svnversion`"
 	fi
-else
-	svn=""
-fi
+	;;
+esac
 
 cat << EOF > vers.c
 $COPYRIGHT



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