* Simplify SRCDIR calculation by directly finding the kernel sources
  based directly on one of them.

Reviewed by: dhw

  This change does not increase the kernel build time.  It also continues
  to restrict the revision to just the kernel sources, and not the whole
  tree.

Timing tests by: dhw


Index: newvers.sh
===================================================================
--- newvers.sh  (revision 204939)
+++ newvers.sh  (working copy)
@@ -89,25 +89,21 @@ i=`${MAKE:-make} -V KERN_IDENT`
 
 case "$d" in
 */sys/*)
-       SRCDIR=${d##*obj}
-       if [ -n "$MACHINE" ]; then
-               SRCDIR=${SRCDIR##/$MACHINE}
-       fi
-       SRCDIR=${SRCDIR%%/sys/*}
+       SRCDIR=$(dirname $0)/..
 
        for dir in /bin /usr/bin /usr/local/bin; do
-               if [ -d "${SRCDIR}/sys/.svn" -a -x "${dir}/svnversion" ] ; then
+               if [ -d "${SRCDIR}/.svn" -a -x "${dir}/svnversion" ] ; then
                        svnversion=${dir}/svnversion
                        break
                fi
-               if [ -d "${SRCDIR}/.git" -a -x "${dir}/git" ] ; then
-                       git_cmd="${dir}/git --git-dir=${SRCDIR}/.git"
+               if [ -d "${SRCDIR}/../.git" -a -x "${dir}/git" ] ; then
+                       git_cmd="${dir}/git --git-dir=${SRCDIR}/../.git"
                        break
                fi
        done
 
        if [ -n "$svnversion" ] ; then
-               svn=" r`cd ${SRCDIR}/sys && $svnversion`"
+               svn=" r`cd ${SRCDIR} && $svnversion`"
        fi
        if [ -n "$git_cmd" ] ; then
                git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null`
@@ -125,7 +121,7 @@ case "$d" in
                                git=" ${git}"
                        fi
                fi
-               if $git_cmd --work-tree=${SRCDIR} diff-index \
+               if $git_cmd --work-tree=${SRCDIR}/.. diff-index \
                    --name-only HEAD | read dummy; then
                        git="${git}-dirty"
                fi

-- 
-- David  (obr...@freebsd.org)
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to