svn commit: r227679 - stable/8/sys/conf
Doug Barton
dougb at FreeBSD.org
Fri Nov 18 21:05:00 UTC 2011
Author: dougb
Date: Fri Nov 18 21:04:59 2011
New Revision: 227679
URL: http://svn.freebsd.org/changeset/base/227679
Log:
MFC r213077:
Simplify how we find the kernel source.
MFC r222218:
expr -> sh arithmetic expansion
MFC r226863:
Fix svnversion for svn 1.7.x by not looking for .svn in ${SYSDIR}
(since it no longer exists). Instead, run svnversion if we can find
the binary and test that the output looks like a version string.
Modified:
stable/8/sys/conf/newvers.sh
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/conf/newvers.sh
==============================================================================
--- stable/8/sys/conf/newvers.sh Fri Nov 18 20:51:31 2011 (r227678)
+++ stable/8/sys/conf/newvers.sh Fri Nov 18 21:04:59 2011 (r227679)
@@ -38,16 +38,16 @@ if [ "X${BRANCH_OVERRIDE}" != "X" ]; the
fi
RELEASE="${REVISION}-${BRANCH}"
VERSION="${TYPE} ${RELEASE}"
+SYSDIR=$(dirname $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)
+ ${SYSDIR}/sys/param.h)
fi
-
b=share/examples/etc/bsd-style-copyright
year=`date '+%Y'`
# look for copyright template
@@ -87,51 +87,47 @@ 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}
+for dir in /bin /usr/bin /usr/local/bin; do
+ if [ -x "${dir}/svnversion" ] ; then
+ svnversion=${dir}/svnversion
+ break
+ fi
+ if [ -d "${SYSDIR}/../.git" -a -x "${dir}/git" ] ; then
+ git_cmd="${dir}/git --git-dir=${SYSDIR}/../.git"
+ break
fi
- SRCDIR=${SRCDIR%%/sys/*}
+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=`cd ${SYSDIR} && $svnversion`
+ case "$svn" in
+ [0-9]*) svn=" r${svn}" ;;
+ *) unset svn ;;
+ esac
+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
- fi
- if $git_cmd --work-tree=${SRCDIR} diff-index \
- --name-only HEAD | read dummy; then
- git="${git}-dirty"
+ git=" ${git}"
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
$COPYRIGHT
@@ -147,4 +143,4 @@ int osreldate = ${RELDATE};
char kern_ident[] = "${i}";
EOF
-echo `expr ${v} + 1` > version
+echo $((v + 1)) > version
More information about the svn-src-stable-8
mailing list