Author: dougb
Date: Wed Aug 26 22:32:14 2009
New Revision: 196571
URL: http://svn.freebsd.org/changeset/base/196571

Log:
  MFC r196435:
  
  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.
  
  Approved by:  re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/conf/newvers.sh
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/newvers.sh
==============================================================================
--- stable/8/sys/conf/newvers.sh        Wed Aug 26 21:42:16 2009        
(r196570)
+++ stable/8/sys/conf/newvers.sh        Wed Aug 26 22:32:14 2009        
(r196571)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to