summaryrefslogtreecommitdiffstats
path: root/sys/conf/newvers.sh
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2008-06-08 19:46:23 +0000
committerdougb <dougb@FreeBSD.org>2008-06-08 19:46:23 +0000
commit1b7168ad8612549a9cc2bc311216a5b692c0b53c (patch)
treecd62844114cfa3e213ce3b085135abc8c0539a4b /sys/conf/newvers.sh
parentc25b436504a13ccd91906a686e6cdc31ef0337a7 (diff)
downloadFreeBSD-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/newvers.sh')
-rw-r--r--sys/conf/newvers.sh13
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
OpenPOWER on IntegriCloud