From owner-freebsd-current@FreeBSD.ORG Fri Mar 12 17:12:07 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64DD6106564A for ; Fri, 12 Mar 2010 17:12:07 +0000 (UTC) (envelope-from obrien@NUXI.org) Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2F4158FC0A for ; Fri, 12 Mar 2010 17:12:06 +0000 (UTC) Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1]) by dragon.nuxi.org (8.14.4/8.14.4) with ESMTP id o2CHC6Z8031783 for ; Fri, 12 Mar 2010 09:12:06 -0800 (PST) (envelope-from obrien@dragon.nuxi.org) Received: (from obrien@localhost) by dragon.nuxi.org (8.14.4/8.14.4/Submit) id o2CHC6sJ031782 for freebsd-current@freebsd.org; Fri, 12 Mar 2010 09:12:06 -0800 (PST) (envelope-from obrien) Date: Fri, 12 Mar 2010 09:12:06 -0800 From: "David O'Brien" To: freebsd-current@freebsd.org Message-ID: <20100312171206.GA31761@dragon.NUXI.org> Mail-Followup-To: obrien@freebsd.org, freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 9.0-CURRENT X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? User-Agent: Mutt/1.5.16 (2007-06-09) Subject: [PATCH] newvers.sh X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 17:12:07 -0000 * 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)