diff options
author | dougb <dougb@FreeBSD.org> | 2008-06-08 19:46:23 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2008-06-08 19:46:23 +0000 |
commit | 1b7168ad8612549a9cc2bc311216a5b692c0b53c (patch) | |
tree | cd62844114cfa3e213ce3b085135abc8c0539a4b /sys/conf | |
parent | c25b436504a13ccd91906a686e6cdc31ef0337a7 (diff) | |
download | FreeBSD-src-1b7168ad8612549a9cc2bc311216a5b692c0b53c.zip FreeBSD-src-1b7168ad8612549a9cc2bc311216a5b692c0b53c.tar.gz |
The change to add subversion ID has two problems. The first is that when
newvers.sh is run pwd is actually the obj directory, so "../../.svn"
doesn't exist and the test always fails. The second is that buildkernel
is executed with a restrictive PATH, so unless you have svnversion in
/bin or /usr/bin it can't run.
Fix this by looking for svnversion in /bin, /usr/bin, and /usr/local/bin
in that order. If found, store the location and derive the value of the
source directory. Then run svnversion in the appropriate directory.
There is one possible refinement which would be to add a test for
LOCALBASE!=/usr/local if we don't find svnversion the first time, but
IMO that's not necessary at this time.
Diffstat (limited to 'sys/conf')
-rw-r--r-- | sys/conf/newvers.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 44bee23..ec5bab5 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -87,8 +87,17 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -if [ -d ../../.svn ] ; then - svn=" @`cd ../.. && svnversion`" +for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + SRCDIR=${SRCDIR%%/sys/*} + break + fi +done + +if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then + svn=" @`cd $SRCDIR && $svnversion`" else svn="" fi |