Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Mar 2010 20:34:35 -0800
From:      "David O'Brien" <obrien@freebsd.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r204824 - head/sys/conf
Message-ID:  <20100310043435.GA96059@dragon.NUXI.org>
In-Reply-To: <20100308.090659.460114267457255328.imp@bsdimp.com>
References:  <201003071008.o27A80wC014578@svn.freebsd.org> <20100307.143619.510313205755027975.imp@bsdimp.com> <20100308010125.GA6387@dragon.NUXI.org> <20100308.090659.460114267457255328.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Mar 08, 2010 at 09:06:59AM -0700, M. Warner Losh wrote:
> In message: <20100308010125.GA6387@dragon.NUXI.org>
>             "David O'Brien" <obrien@FreeBSD.org> writes:
> : On Sun, Mar 07, 2010 at 02:36:19PM -0700, M. Warner Losh wrote:
> : > Please back out this change.  It is unwise, I think.
> : 
> : Instead I'd rather fix it for the use case you mention.
> 
> I'd still rather you back it out because it introduces a significant
> regression in speed, see below...

Can you please apply this diff:

Index: conf/kern.post.mk
===================================================================
--- conf/kern.post.mk	(revision 204912)
+++ conf/kern.post.mk	(working copy)
@@ -247 +247 @@ vers.c: $S/conf/newvers.sh $S/sys/param.
-	MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT}
+	MAKE=${MAKE} sh -x $S/conf/newvers.sh ${KERN_IDENT}

and send me the output of:
    rm /usr/obj/MM/test/sys/GENERIC/vers*
    make -DNOCLEAN buildkernel

I would like to understand and fix how my patch causes you longer build
times than r197433.

Attached are my typescripts for r197433 and the patch I sent you.  The
diff of which is:


--- typescript,r197433	2010-03-09 20:11:35.000000000 -0800
+++ typescript,new	2010-03-09 20:11:50.000000000 -0800
@@ -104,17 +104,16 @@ MAKE=make sh -x /MM/test/sys/conf/newver
 + cat version
 + pwd
 + date
-+ v=1 u=rootk d=/usr/obj/MM/test/sys/GENERIC h=dragon t='Tue Mar  9 20:06:11 PST 2010'
++ v=6 u=rootk d=/usr/obj/MM/test/sys/GENERIC h=dragon t='Tue Mar  9 20:20:33 PST 2010'
 + make -V KERN_IDENT
 + i=GENERIC
-+ SRCDIR=/MM/test/sys/GENERIC
-+ [ -n i386 ]
-+ SRCDIR=/MM/test/sys/GENERIC
-+ SRCDIR=/MM/test
++ dirname /MM/test/sys/conf/newvers.sh
++ realpath /MM/test/sys/conf/..
++ SRCDIR=/MM/test/sys
 + [ -d /MM/test/sys/.svn -a -x /bin/svnversion ]
-+ [ -d /MM/test/.git -a -x /bin/git ]
++ [ -d /MM/test/sys/.git -a -x /bin/git ]
 + [ -d /MM/test/sys/.svn -a -x /usr/bin/svnversion ]
-+ [ -d /MM/test/.git -a -x /usr/bin/git ]
++ [ -d /MM/test/sys/.git -a -x /usr/bin/git ]
 + [ -d /MM/test/sys/.svn -a -x /usr/local/bin/svnversion ]
 + svnversion=/usr/local/bin/svnversion
 + break

As you can see, the same .svn/ directory is used in my patch as in
r197433.

I think looking for .git/ in the same directory as .svn/ make sense, but
I'm not a heavy git user.  Assuming you disagree, the attached patch will
look above the kernel directory.  If it bothers you to run realpath(1)
twice, I can save its output in a shell var and use that.



> : Index: newvers.sh
..
> : -	SRCDIR=${d##*obj}
..

> : +	SRCDIR=$(realpath $(dirname $0)/..)

Is your newver.sh script in the normal place within 'conf/'?



> : Do you get the subversion revision in your vers.c file with this patch?
> 
> Well, except that you get the revision for the whole tree, instead of
> just for the kernel.  And this takes a *LOT* longer to compute.  The
> whole reason we did the sys hack was to make build times not suck...

Please send me the typescript output from with conf/kern.post.mk
patch.  I need to see how "SRCDIR" is getting set to "/usr/src" for you
and not "/usr/src/sys".

-- 
-- David  (obrien@FreeBSD.org)

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="typescript,r197433"

MAKE=make sh -x /MM/test/sys/conf/newvers.sh GENERIC
+ TYPE=FreeBSD
+ REVISION=9.0
+ BRANCH=CURRENT
+ [ X != X ]
+ RELEASE=9.0-CURRENT
+ VERSION='FreeBSD 9.0-CURRENT'
+ [ X != X ]
+ dirname /MM/test/sys/conf/newvers.sh
+ awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' /MM/test/sys/conf/../sys/param.h
+ RELDATE=900009
+ b=share/examples/etc/bsd-style-copyright
+ date +%Y
+ year=2010
+ [ -r ../share/examples/etc/bsd-style-copyright ]
+ [ -r ../../share/examples/etc/bsd-style-copyright ]
+ [ -r ../../../share/examples/etc/bsd-style-copyright ]
+ [ -r /usr/src/share/examples/etc/bsd-style-copyright ]
+ sed -e 's/\[year\]/1992-2010/' -e 's/\[your name here\]\.* /The FreeBSD Project./' -e 's/\[your name\]\.*/The FreeBSD Project./' -e '/\[id for your version control system, if any\]/d' /usr/src/share/examples/etc/bsd-style-copyright
+ COPYRIGHT='/*-
 * Copyright (c) 1992-2010 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'\'\'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */'
+ break
+ [ 'X/*-
 * Copyright (c) 1992-2010 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'\'\'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */' = X ]
+ COPYRIGHT='/*-
 * Copyright (c) 1992-2010 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'\'\'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */
'
+ LC_ALL=C
+ export LC_ALL
+ [ ! -r version ]
+ touch version
+ cat version
+ pwd
+ date
+ v=1 u=rootk d=/usr/obj/MM/test/sys/GENERIC h=dragon t='Tue Mar  9 19:06:11 PST 2010'
+ make -V KERN_IDENT
+ i=GENERIC
+ SRCDIR=/MM/test/sys/GENERIC
+ [ -n i386 ]
+ SRCDIR=/MM/test/sys/GENERIC
+ SRCDIR=/MM/test
+ [ -d /MM/test/sys/.svn -a -x /bin/svnversion ]
+ [ -d /MM/test/.git -a -x /bin/git ]
+ [ -d /MM/test/sys/.svn -a -x /usr/bin/svnversion ]
+ [ -d /MM/test/.git -a -x /usr/bin/git ]
+ [ -d /MM/test/sys/.svn -a -x /usr/local/bin/svnversion ]
+ svnversion=/usr/local/bin/svnversion
+ break
+ [ -n /usr/local/bin/svnversion ]
+ cd /MM/test/sys
+ /usr/local/bin/svnversion
+ svn=' r204912M'
+ [ -n '' ]
+ cat
+ expr 1 + 1
+ echo 2

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="typescript,new"

MAKE=make sh -x /MM/test/sys/conf/newvers.sh GENERIC
+ TYPE=FreeBSD
+ REVISION=9.0
+ BRANCH=CURRENT
+ [ X != X ]
+ RELEASE=9.0-CURRENT
+ VERSION='FreeBSD 9.0-CURRENT'
+ [ X != X ]
+ dirname /MM/test/sys/conf/newvers.sh
+ awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' /MM/test/sys/conf/../sys/param.h
+ RELDATE=900009
+ b=share/examples/etc/bsd-style-copyright
+ date +%Y
+ year=2010
+ [ -r ../share/examples/etc/bsd-style-copyright ]
+ [ -r ../../share/examples/etc/bsd-style-copyright ]
+ [ -r ../../../share/examples/etc/bsd-style-copyright ]
+ [ -r /usr/src/share/examples/etc/bsd-style-copyright ]
+ sed -e 's/\[year\]/1992-2010/' -e 's/\[your name here\]\.* /The FreeBSD Project./' -e 's/\[your name\]\.*/The FreeBSD Project./' -e '/\[id for your version control system, if any\]/d' /usr/src/share/examples/etc/bsd-style-copyright
+ COPYRIGHT='/*-
 * Copyright (c) 1992-2010 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'\'\'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */'
+ break
+ [ 'X/*-
 * Copyright (c) 1992-2010 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'\'\'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */' = X ]
+ COPYRIGHT='/*-
 * Copyright (c) 1992-2010 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'\'\'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */
'
+ LC_ALL=C
+ export LC_ALL
+ [ ! -r version ]
+ touch version
+ cat version
+ pwd
+ date
+ v=6 u=rootk d=/usr/obj/MM/test/sys/GENERIC h=dragon t='Tue Mar  9 19:40:33 PST 2010'
+ make -V KERN_IDENT
+ i=GENERIC
+ dirname /MM/test/sys/conf/newvers.sh
+ realpath /MM/test/sys/conf/..
+ SRCDIR=/MM/test/sys
+ [ -d /MM/test/sys/.svn -a -x /bin/svnversion ]
+ [ -d /MM/test/sys/.git -a -x /bin/git ]
+ [ -d /MM/test/sys/.svn -a -x /usr/bin/svnversion ]
+ [ -d /MM/test/sys/.git -a -x /usr/bin/git ]
+ [ -d /MM/test/sys/.svn -a -x /usr/local/bin/svnversion ]
+ svnversion=/usr/local/bin/svnversion
+ break
+ [ -n /usr/local/bin/svnversion ]
+ cd /MM/test/sys
+ /usr/local/bin/svnversion
+ svn=' r204912M'
+ [ -n '' ]
+ cat
+ expr 1 + 1
+ echo 2

--3MwIy2ne0vdjdPXF
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="srcgit.patch"

Index: conf/newvers.sh
===================================================================
--- conf/newvers.sh	(revision 204912)
+++ conf/newvers.sh	(working copy)
@@ -87,21 +87,19 @@ touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
+# Are we doing a kernel build?  Look for "/sys/" in pwd for 'make kernel',
+# and "/compile/" for tradiational within-tree kernel build.
 case "$d" in
-*/compile/*)
-	SRCDIR=${d##*obj}
-	if [ -n "$MACHINE" ]; then
-		SRCDIR=${SRCDIR##/$MACHINE}
-	fi
-	SRCDIR=$(cd ${SRCDIR%%/compile/*}/.. && pwd)
+*/sys/*|*/compile/*)
+	SRCDIR=$(realpath $(dirname $0)/..)
 
 	for dir in /bin /usr/bin /usr/local/bin; do
 		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

--3MwIy2ne0vdjdPXF--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100310043435.GA96059>