Date: Fri, 12 Mar 2010 09:12:06 -0800 From: "David O'Brien" <obrien@freebsd.org> To: freebsd-current@freebsd.org Subject: [PATCH] newvers.sh Message-ID: <20100312171206.GA31761@dragon.NUXI.org>
next in thread | raw e-mail | index | archive | help
* 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 (obrien@FreeBSD.org)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100312171206.GA31761>