Re: svn commit: r190514 - head/sys/conf

From: Doug Barton <dougb_at_FreeBSD.org>
Date: Sat, 15 Aug 2009 12:34:36 -0700
John Baldwin wrote:
> On Thursday 13 August 2009 2:57:10 pm Doug Barton wrote:
>> Bjoern A. Zeeb wrote:
>>> Author: bz
>>> Date: Sat Mar 28 23:17:18 2009
>>> New Revision: 190514
>>> URL: http://svn.freebsd.org/changeset/base/190514
>>>
>>> Log:
>>>   For kernel builds reduce the impact of svnversion, just scanning
>>>   src/sys and not the entire src/ tree.
>> Also, what problem are we really trying to solve here? With a
>> populated cache it takes on average 5 seconds to run all of src, and
>> just under 1 to do only sys. Is 4 seconds really that important to
>> save? With a dry cache I'm sure it takes a little longer, but has
>> anyone actually measured this?
> 
> It takes far longer than 5 seconds here against a local SVN repo over NFS.

Looking at this in a little more depth, the only place that the
svnversion feature is relevant is for the kernel build. The other
places that call newvers.sh don't make use of that information.

So I've got a patch to the current version that only does the svn
stuff if newvers.sh is being called for the kernel build. I've
attached the regular svn diff and a -bB version since it's a bit hard
to read. It's easier to see what's going on if you apply it.

If no one objects I'll ask re_at_ for approval to commit it.


Doug

-- 

    This .signature sanitized for your protection


Index: newvers.sh
===================================================================
--- newvers.sh	(revision 196257)
+++ newvers.sh	(working copy)
_at__at_ -87,29 +87,25 @@
 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
--- .svn/text-base/newvers.sh.svn-base	2009-07-16 13:20:31.000000000 -0700
+++ newvers.sh	2009-08-15 12:29:27.000000000 -0700
_at__at_ -28,7 +28,7 _at__at_
 # SUCH DAMAGE.
 #
 #	_at_(#)newvers.sh	8.1 (Berkeley) 4/20/94
-# $FreeBSD$
+# $FreeBSD: head/sys/conf/newvers.sh 195712 2009-07-15 17:29:05Z kensmith $
 
 TYPE="FreeBSD"
 REVISION="8.0"
_at__at_ -87,7 +87,9 _at__at_
 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
+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}
_at__at_ -97,19 +99,13 _at__at_
 		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
Received on Sat Aug 15 2009 - 17:34:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC