Re: [PATCH] newvers.sh

2010-03-15 Thread David O'Brien
On Sat, Mar 13, 2010 at 09:13:03PM -0700, M. Warner Losh wrote:
 In message: 20100312171206.ga31...@dragon.nuxi.org
 David O'Brien obr...@freebsd.org writes:
 : * 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
 
 patch omitted
 
 I have a better simplification, I think, that works for me for each of
 the tests that I've done (both traditional and buildkernel builds).

I also have other simplifications.  But want to do this in stages,
least there be some corner case or misunderstanding by someone.

 Can you confirm this works for you and also comment on the change
 itself?  It is a bigger change, but results in a simpler (I think)
 newvers.sh.
 Comments?

I would prefer to do this in stages so things aren't misunderstood.
This patch is one of the key parts that shows I am not making the
'svnversion' run take longer, and that it does not cover more of
the tree than before.

-- 
-- 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


Re: [PATCH] newvers.sh

2010-03-15 Thread M. Warner Losh
In message: 20100315142806.ga5...@dragon.nuxi.org
David O'Brien obr...@freebsd.org writes:
: On Sat, Mar 13, 2010 at 09:13:03PM -0700, M. Warner Losh wrote:
:  In message: 20100312171206.ga31...@dragon.nuxi.org
:  David O'Brien obr...@freebsd.org writes:
:  : * 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
:  
:  patch omitted
:  
:  I have a better simplification, I think, that works for me for each of
:  the tests that I've done (both traditional and buildkernel builds).
: 
: I also have other simplifications.  But want to do this in stages,
: least there be some corner case or misunderstanding by someone.

Normally this is a sensible process.  However, my patches change how
we guess where sys is, and as such, I think we should go directly
there and work out the corner cases and such there.

:  Can you confirm this works for you and also comment on the change
:  itself?  It is a bigger change, but results in a simpler (I think)
:  newvers.sh.
:  Comments?
: 
: I would prefer to do this in stages so things aren't misunderstood.
: This patch is one of the key parts that shows I am not making the
: 'svnversion' run take longer, and that it does not cover more of
: the tree than before.

That's exactly what my patch does by passing in SYSDIR directly.  Why
guess and then replace it with a different guess.  Why not go directly
to the best guess immediately?  We know it is always right, because we
know it is what the kernel is using to build itself.  And we know
that's the directory we want to use for the svn command.

Warner
___
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


Re: [PATCH] newvers.sh

2010-03-15 Thread David O'Brien
On Mon, Mar 15, 2010 at 08:44:26AM -0600, M. Warner Losh wrote:
 In message: 20100315142806.ga5...@dragon.nuxi.org
 David O'Brien obr...@freebsd.org writes:
 : On Sat, Mar 13, 2010 at 09:13:03PM -0700, M. Warner Losh wrote:
 :  In message: 20100312171206.ga31...@dragon.nuxi.org
 :  David O'Brien obr...@freebsd.org writes:
 :  : * 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
 :  
 :  patch omitted
 :  
 :  I have a better simplification, I think, that works for me for each of
 :  the tests that I've done (both traditional and buildkernel builds).
 : 
 : I also have other simplifications.  But want to do this in stages,
 : least there be some corner case or misunderstanding by someone.
 
 Normally this is a sensible process.  However, my patches change how
 we guess where sys is, and as such, I think we should go directly
 there and work out the corner cases and such there.

Well that's what I was trying to do with the patch I sent you in
Message-ID: 20100308010125.ga6...@dragon.nuxi.org on 7-March-2010.
There you didn't care for that approach and would not give details
as to the claims you made.

I will reply in another email the issues with your patch.

 : I would prefer to do this in stages so things aren't misunderstood.
 : This patch is one of the key parts that shows I am not making the
 : 'svnversion' run take longer, and that it does not cover more of
 : the tree than before.
 
 That's exactly what my patch does by passing in SYSDIR directly.  Why
 guess and then replace it with a different guess.

Guess???  'newvers.sh' is not going to be within the kernel sources
tree??  Are you allowing for the person that did a 'mv sys/conf/newvers.sh'
to elsewhere?  Considering you have sh $S/conf/newvers.sh, I don't see
where you are.  Is $0 confusing you?

-- 
-- 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


Re: [PATCH] newvers.sh

2010-03-15 Thread David O'Brien
On Sat, Mar 13, 2010 at 09:13:03PM -0700, M. Warner Losh wrote:
 The Makefile already knows where the kernel src is located.  Let's use
 that knowledge to make things a little simpler.  This also uses the
 Makefile variable SYSDIR.  It should also work with non-standard sys
 directories.
..
 Index: conf/kern.post.mk
  vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
 - MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT}
 + MAKE=${MAKE} SYSDIR=$S sh $S/conf/newvers.sh ${KERN_IDENT}

I'd rather not introduce yet more special things that have to be done
before invoking newvers.sh.   (MAKE=${MAKE} sh is not an issue as the
script works if MAKE is not passed in given it has ${MAKE:-make}).

The script can be more self contained than this, and I think that is
technically better.


 Index: conf/newvers.sh
 ===
 --- conf/newvers.sh   (revision 204938)
 +++ conf/newvers.sh   (working copy)
 @@ -44,7 +44,7 @@
   ${PARAMFILE})
  else
   RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
 - $(dirname $0)/../sys/param.h)
 + ${SYSDIR}/sys/param.h)

I don't think we should depend on having SYSDIR defined before invoking
newvers.sh.  Its worse than requiring that as a parameter.  We don't set
KERN_IDENT=$KERN_IDENT before invoking newvers.sh.

Either
MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT} $S
or
MAKE=${MAKE} SYSDIR=$S KERN_IDENT=$KERN_IDENT sh $S/conf/newvers.sh

for regularity.  But I really feel we can trust 'newvers.sh' to be within
the kernel sources directory - thus $(dirname $0)/.. is a
self-contained method to determining what the kernel directory is.
No guessing.  This can be optimized to ${0%/*}/...


 -v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 +v=`cat version` u=${USER:-root} h=${HOSTNAME:-`hostname`} t=`date`

Unfortunately, I don't believe you actually read the entire newvers.sh script.
(this is likely why you misread my patch in Message-ID:
20100308010125.ga6...@dragon.nuxi.org)  Did you get the proper output
in your testing?  From what I see, It causes a problem with the ${d}
usage in this part of newvers.sh:

  #define VERSTR ${VERSION} #${v}${svn}${git}: ${t}\\n$...@${h}:${d}\\n

Thus when building with make buildkernel, your patch produces vers.c as:

 #define VERSTR FreeBSD 9.0-CURRENT #0 r204912M: Mon Mar 15 12:46:05 PDT 
2010\nro...@dragon.nuxi.org:\n

Instead of:

 #define VERSTR FreeBSD 9.0-CURRENT #0 r204912M: Mon Mar 15 12:57:01 PDT 
2010\nro...@dragon.nuxi.org:/usr/obj/MM/test/sys/GENERIC\n


 -case $d in
 -*/sys/*)
..
 +for dir in /bin /usr/bin /usr/local/bin; do
 + if [ -d ${SYSDIR}/.svn -a -x ${dir}/svnversion ] ; then
 + svnversion=${dir}/svnversion
..
 - for dir in /bin /usr/bin /usr/local/bin; do
 - if [ -d ${SRCDIR}/sys/.svn -a -x ${dir}/svnversion ] ; then

Are you implicitly depending on there not being a '.svn/' in the root
directory?  The invocation of 'newvers.sh' elsewhere in the tree will not
have 'SYSDIR' (of your patch) set, so the test will be (last iteration):

if [ -d /.svn -a -x $/usr/local/bin/svnversion ] ; then

I'd rather not limit the user to not having '/.svn' that is used to
track configuration files, etc...

This patch is the end version I was working to (thru a series of
changes):

* Simplify SRCDIR calculation by directly finding the kernel sources
  based directly on one of them.
* Rename SRCDIR to KERN_TOPDIR to be more clear which sources these are,
  and at what level
* git isn't in the base system and being GPL'ed, likely never will.
* Revisit r196435 - rather than guess if 'newvers.sh' is being
  invoked as part of the kernel build or not based on a path (proven
  to be fragile), key off of having a KERN_IDENT.


Index: newvers.sh
===
--- newvers.sh  (revision 204939)
+++ newvers.sh  (working copy)
@@ -39,12 +39,13 @@ fi
 RELEASE=${REVISION}-${BRANCH}
 VERSION=${TYPE} ${RELEASE}
 
+KERN_TOPDIR=${0%/*}/..
 if [ X${PARAMFILE} != X ]; then
RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
${PARAMFILE})
 else
RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
-   $(dirname $0)/../sys/param.h)
+   ${KERN_TOPDIR}/sys/param.h)
 fi
 
 
@@ -87,27 +88,22 @@ touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
-case $d in
-*/sys/*)
-   SRCDIR=${d##*obj}
-   if [ -n $MACHINE ]; then
-   SRCDIR=${SRCDIR##/$MACHINE}
-   fi
-   SRCDIR=${SRCDIR%%/sys/*}
-
+case $i in
+)
+   ;;
+*)
for dir in /bin /usr/bin /usr/local/bin; do
-   if [ -d ${SRCDIR}/sys/.svn -a -x ${dir}/svnversion ] ; then
+   if [ -d ${KERN_TOPDIR}/.svn -a -x ${dir}/svnversion ] ; then
  

Re: [PATCH] newvers.sh

2010-03-15 Thread M. Warner Losh
In message: 20100316002939.ga36...@dragon.nuxi.org
David O'Brien obr...@freebsd.org writes:
: On Mon, Mar 15, 2010 at 08:44:26AM -0600, M. Warner Losh wrote:
:  In message: 20100315142806.ga5...@dragon.nuxi.org
:  David O'Brien obr...@freebsd.org writes:
:  : On Sat, Mar 13, 2010 at 09:13:03PM -0700, M. Warner Losh wrote:
:  :  In message: 20100312171206.ga31...@dragon.nuxi.org
:  :  David O'Brien obr...@freebsd.org writes:
:  :  : * 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
:  :  
:  :  patch omitted
:  :  
:  :  I have a better simplification, I think, that works for me for each of
:  :  the tests that I've done (both traditional and buildkernel builds).
:  : 
:  : I also have other simplifications.  But want to do this in stages,
:  : least there be some corner case or misunderstanding by someone.
:  
:  Normally this is a sensible process.  However, my patches change how
:  we guess where sys is, and as such, I think we should go directly
:  there and work out the corner cases and such there.
: 
: Well that's what I was trying to do with the patch I sent you in
: Message-ID: 20100308010125.ga6...@dragon.nuxi.org on 7-March-2010.
: There you didn't care for that approach and would not give details
: as to the claims you made.

I saw your patch and thought this one would be better and simplify
newvers.sh.  I saw nothing wrong, per se, with the patch.  Instead, I
saw an opportunity to refine it and make the resulting newvers.sh
simpler by using values already computed by the build system.

: I will reply in another email the issues with your patch.

I welcome constructive criticism of the patch.

:  : I would prefer to do this in stages so things aren't misunderstood.
:  : This patch is one of the key parts that shows I am not making the
:  : 'svnversion' run take longer, and that it does not cover more of
:  : the tree than before.
:  
:  That's exactly what my patch does by passing in SYSDIR directly.  Why
:  guess and then replace it with a different guess.
: 
: Guess???  'newvers.sh' is not going to be within the kernel sources
: tree??  Are you allowing for the person that did a 'mv sys/conf/newvers.sh'
: to elsewhere?  Considering you have sh $S/conf/newvers.sh, I don't see
: where you are.  Is $0 confusing you?

The kernel source tree is inferred from $0, yes.  My method passes it
in directly, and makes newvers.sh shell variable usage more uniform
with the rest of the kernel.  It also eliminated a number of lines
from newvers.sh by using the value the kernel build process already
had cached.  The elimination of duplicated computation is why I think
this is a better approach.

Warner
___
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


Re: [PATCH] newvers.sh

2010-03-15 Thread Doug Barton
On 03/15/10 17:41, David O'Brien wrote:
 I'd rather not introduce yet more special things that have to be done
 before invoking newvers.sh.  

David,

Trying to understand what you're getting at here. What's your use case
for invoking newvers.sh from the command line? AFAIK it's only every
used as part of the build process. Once by the kernel build and once for
library related stuff (IIRC).


Doug

-- 

... and that's just a little bit of history repeating.
-- Propellerheads

Improve the effectiveness of your Internet presence with
a domain name makeover!http://SupersetSolutions.com/

___
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


Re: [PATCH] newvers.sh

2010-03-15 Thread M. Warner Losh
David

In message: 20100316004117.gb36...@dragon.nuxi.org
David O'Brien obr...@freebsd.org writes:
: On Sat, Mar 13, 2010 at 09:13:03PM -0700, M. Warner Losh wrote:
:  The Makefile already knows where the kernel src is located.  Let's use
:  that knowledge to make things a little simpler.  This also uses the
:  Makefile variable SYSDIR.  It should also work with non-standard sys
:  directories.
: ..
:  Index: conf/kern.post.mk
:   vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
:  -   MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT}
:  +   MAKE=${MAKE} SYSDIR=$S sh $S/conf/newvers.sh ${KERN_IDENT}
: 
: I'd rather not introduce yet more special things that have to be done
: before invoking newvers.sh.   (MAKE=${MAKE} sh is not an issue as the
: script works if MAKE is not passed in given it has ${MAKE:-make}).
: 
: The script can be more self contained than this, and I think that is
: technically better.

OK.  I think that passing the info in isn't that big a deal and makes
the dependency more explicit.

:  Index: conf/newvers.sh
:  ===
:  --- conf/newvers.sh (revision 204938)
:  +++ conf/newvers.sh (working copy)
:  @@ -44,7 +44,7 @@
:  ${PARAMFILE})
:   else
:  RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
:  -   $(dirname $0)/../sys/param.h)
:  +   ${SYSDIR}/sys/param.h)
: 
: I don't think we should depend on having SYSDIR defined before invoking
: newvers.sh.  Its worse than requiring that as a parameter.  We don't set
: KERN_IDENT=$KERN_IDENT before invoking newvers.sh.
: 
: Either
: MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT} $S
: or
: MAKE=${MAKE} SYSDIR=$S KERN_IDENT=$KERN_IDENT sh $S/conf/newvers.sh
: 
: for regularity.  But I really feel we can trust 'newvers.sh' to be within
: the kernel sources directory - thus $(dirname $0)/.. is a
: self-contained method to determining what the kernel directory is.
: No guessing.  This can be optimized to ${0%/*}/...

You are trading one dependency for another here.  Either you pass it
in by typing the path to newvers.sh, or you pass it in directly from
the kernel build.  But it would be cleaner if it were passed in as the
first parameter.

:  -v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
:  +v=`cat version` u=${USER:-root} h=${HOSTNAME:-`hostname`} t=`date`
: 
: Unfortunately, [snipped] [[ ${d} is used later, and silent succeeds
: with the wrong results with your patch ]]

$d is used later.  Gotcha.  I missed that.

:  -case $d in
:  -*/sys/*)
: ..
:  +for dir in /bin /usr/bin /usr/local/bin; do
:  +   if [ -d ${SYSDIR}/.svn -a -x ${dir}/svnversion ] ; then
:  +   svnversion=${dir}/svnversion
: ..
:  -   for dir in /bin /usr/bin /usr/local/bin; do
:  -   if [ -d ${SRCDIR}/sys/.svn -a -x ${dir}/svnversion ] ; then
: 
: Are you implicitly depending on there not being a '.svn/' in the root
: directory?

Assuming that you violated the precondition of passing SYSDIR in, then
yes.  However, I don't think that's a big deal.

: The invocation of 'newvers.sh' elsewhere in the tree will not
: have 'SYSDIR' (of your patch) set, so the test will be (last iteration):
: 
: if [ -d /.svn -a -x $/usr/local/bin/svnversion ] ; then
: 
: I'd rather not limit the user to not having '/.svn' that is used to
: track configuration files, etc...
:
: This patch is the end version I was working to (thru a series of
: changes):
: 
: * Simplify SRCDIR calculation by directly finding the kernel sources
:   based directly on one of them.
: * Rename SRCDIR to KERN_TOPDIR to be more clear which sources these are,
:   and at what level
: * git isn't in the base system and being GPL'ed, likely never will.
: * Revisit r196435 - rather than guess if 'newvers.sh' is being
:   invoked as part of the kernel build or not based on a path (proven
:   to be fragile), key off of having a KERN_IDENT.

Comments below...

: Index: newvers.sh
: ===
: --- newvers.sh(revision 204939)
: +++ newvers.sh(working copy)
: @@ -39,12 +39,13 @@ fi
:  RELEASE=${REVISION}-${BRANCH}
:  VERSION=${TYPE} ${RELEASE}
:  
: +KERN_TOPDIR=${0%/*}/..

I'd have selected SYSDIR, which is used elsewhere in the build system
to indicate the top of the kernel tree.

:  if [ X${PARAMFILE} != X ]; then
:   RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
:   ${PARAMFILE})
:  else
:   RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
: - $(dirname $0)/../sys/param.h)
: + ${KERN_TOPDIR}/sys/param.h)
:  fi
:  

If we move this grep into include/Makefile, then we can eliminate
this entire conditional, leaving only the else part of it.

: @@ -87,27 +88,22 @@ touch version
:  v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
:  i=`${MAKE:-make} -V 

Re: [PATCH] newvers.sh

2010-03-15 Thread M. Warner Losh
In message: 4b9edb05.4020...@freebsd.org
Doug Barton do...@freebsd.org writes:
: On 03/15/10 17:41, David O'Brien wrote:
:  I'd rather not introduce yet more special things that have to be done
:  before invoking newvers.sh.  
: 
: David,
: 
: Trying to understand what you're getting at here. What's your use case
: for invoking newvers.sh from the command line? AFAIK it's only every
: used as part of the build process. Once by the kernel build and once for
: library related stuff (IIRC).

It is used in the kernel build (in a couple of different places) and
in include/Makefile to generate osreldate.h.  I believe the latter can
be simplified to not require it.

Warner
___
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


Re: [PATCH] newvers.sh

2010-03-15 Thread Doug Barton
On 03/15/10 18:34, M. Warner Losh wrote:
 In message: 4b9edb05.4020...@freebsd.org
 Doug Barton do...@freebsd.org writes:
 : On 03/15/10 17:41, David O'Brien wrote:
 :  I'd rather not introduce yet more special things that have to be done
 :  before invoking newvers.sh.  
 : 
 : David,
 : 
 : Trying to understand what you're getting at here. What's your use case
 : for invoking newvers.sh from the command line? AFAIK it's only every
 : used as part of the build process. Once by the kernel build and once for
 : library related stuff (IIRC).
 
 It is used in the kernel build (in a couple of different places) and
 in include/Makefile to generate osreldate.h. 

Well, includes are related to libraries, right/ :)

 I believe the latter can be simplified to not require it.

When I last looked at it I vaguely recall thinking that not needing
newvers.sh for that purpose was a good goal, but ENOTIME.


Thanks for refreshing my memory,

Doug

-- 

... and that's just a little bit of history repeating.
-- Propellerheads

Improve the effectiveness of your Internet presence with
a domain name makeover!http://SupersetSolutions.com/

___
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


Re: [PATCH] newvers.sh

2010-03-15 Thread M. Warner Losh
In message: 4b9ee1ad.9080...@freebsd.org
Doug Barton do...@freebsd.org writes:
:  I believe the latter can be simplified to not require it.
: 
: When I last looked at it I vaguely recall thinking that not needing
: newvers.sh for that purpose was a good goal, but ENOTIME.

Right now it is required to set COPYRIGHT and RELDATE.  The former
isn't necessary (I don't believe this file could be copyrighted) and
the latter could be replaced with a simple grep.

Warner
___
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


Re: [PATCH] newvers.sh

2010-03-13 Thread M. Warner Losh
In message: 20100312171206.ga31...@dragon.nuxi.org
David O'Brien obr...@freebsd.org writes:
: * 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

patch omitted

David,

I have a better simplification, I think, that works for me for each of
the tests that I've done (both traditional and buildkernel builds).

The Makefile already knows where the kernel src is located.  Let's use
that knowledge to make things a little simpler.  This also uses the
Makefile variable SYSDIR.  It should also work with non-standard sys
directories.

There's one divergence between svn and git tagging: svn does src/sys,
while git does src.  This is how the previous code was before, and I
don't think I've changed that.

Can you confirm this works for you and also comment on the change
itself?  It is a bigger change, but results in a simpler (I think)
newvers.sh.

Comments?

Warner

Index: conf/kern.post.mk
===
--- conf/kern.post.mk   (revision 204938)
+++ conf/kern.post.mk   (working copy)
@@ -244,7 +244,7 @@
${NORMAL_LINT}
 
 vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
-   MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT}
+   MAKE=${MAKE} SYSDIR=$S sh $S/conf/newvers.sh ${KERN_IDENT}
 
 vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c
Index: conf/newvers.sh
===
--- conf/newvers.sh (revision 204938)
+++ conf/newvers.sh (working copy)
@@ -44,7 +44,7 @@
${PARAMFILE})
 else
RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \
-   $(dirname $0)/../sys/param.h)
+   ${SYSDIR}/sys/param.h)
 fi
 
 
@@ -84,54 +84,46 @@
 fi
 
 touch version
-v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
+v=`cat version` u=${USER:-root} h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
-case $d in
-*/sys/*)
-   SRCDIR=${d##*obj}
-   if [ -n $MACHINE ]; then
-   SRCDIR=${SRCDIR##/$MACHINE}
+for dir in /bin /usr/bin /usr/local/bin; do
+   if [ -d ${SYSDIR}/.svn -a -x ${dir}/svnversion ] ; then
+   svnversion=${dir}/svnversion
+   break
fi
-   SRCDIR=${SRCDIR%%/sys/*}
+   if [ -d ${SYSDIR}/../.git -a -x ${dir}/git ] ; then
+   git_cmd=${dir}/git --git-dir=${SYSDIR}/../.git
+   break
+   fi
+done
 
-   for dir in /bin /usr/bin /usr/local/bin; do
-   if [ -d ${SRCDIR}/sys/.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
-   break
-   fi
-   done
+if [ -n $svnversion ] ; then
+echo $svnversion
+   svn= r`cd ${SYSDIR}  $svnversion`
+fi
 
-   if [ -n $svnversion ] ; then
-   svn= r`cd ${SRCDIR}/sys  $svnversion`
-   fi
-   if [ -n $git_cmd ] ; then
-   git=`$git_cmd rev-parse --verify --short HEAD 2/dev/null`
-   svn=`$git_cmd svn find-rev $git 2/dev/null`
-   if [ -n $svn ] ; then
+if [ -n $git_cmd ] ; then
+   git=`$git_cmd rev-parse --verify --short HEAD 2/dev/null`
+   svn=`$git_cmd svn find-rev $git 2/dev/null`
+   if [ -n $svn ] ; then
+   svn= r${svn}
+   git==${git}
+   else
+   svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \
+sed -n 's/^...@\([0-9][0-9]*\).*$/\1/p'`
+   if [ -n $svn ] ; then
svn= r${svn}
-   git==${git}
+   git=+${git}
else
-   svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \
-sed -n 's/^...@\([0-9][0-9]*\).*$/\1/p'`
-   if [ -n $svn ] ; then
-   svn= r${svn}
-   git=+${git}
-   else
-   git= ${git}
-   fi
+   git= ${git}
fi
-   if $git_cmd --work-tree=${SRCDIR} diff-index \
-   --name-only HEAD | read dummy; then
-   git=${git}-dirty
-   fi
fi
-   ;;
-esac
+   if $git_cmd --work-tree=${SYSDIR}/.. diff-index \
+   --name-only HEAD | read dummy; then
+   git=${git}-dirty
+   fi
+fi
 
 cat  EOF  vers.c