From 7e7d17cb48838b48389fb990950f2959b9635e63 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Tue, 19 May 2009 16:04:12 +0200 Subject: [PATCH] newvers.sh: Take the src/ dir as an argument instead of hard coding it. This fixes the issue where the last number in our version was included only if /usr/src was present at build time, which resulted in different output of uname -r, sysctl kern.{osrelease,version}, etc. across different systems (e.g. "2.3.1-DEVELOPMENT" vs. "2.3-DEVELOPMENT"). This commit also removes the passing of ${KERN_IDENT} and ${IDENT} to newvers.sh (both of which are not used by it) and performs some additional cleanup. Brought-to-my-attention-by: Antonio Huete Jimenez Reviewed-by: dillon --- sys/conf/kern.post.mk | 2 +- sys/conf/newvers.sh | 42 +++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 09c9de0276..82626045a2 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -225,7 +225,7 @@ ioconf.o: ${NORMAL_C} vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} - sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} + sh $S/conf/newvers.sh $S/.. # XXX strictly, everything depends on Makefile because changes to ${PROF} # only appear there, but we don't handle that. diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 47c6ed47eb..a94a3bb304 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -35,6 +35,13 @@ # $FreeBSD: src/sys/conf/newvers.sh,v 1.44.2.30 2003/04/04 07:02:46 murray Exp $ # $DragonFly: src/sys/conf/newvers.sh,v 1.23 2008/07/14 04:01:44 dillon Exp $ +# The directory where the source resides +# +SRCDIR=$1 +if [ "${SRCDIR}" = "" ]; then + SRCDIR=$(dirname $0)/../.. +fi + # Set the branch # BRANCH="DEVELOPMENT_2_3" @@ -63,15 +70,13 @@ if [ "${REVISION}" != "${BRANCH}" ]; then REVISION=$(echo $REVISION | sed -e 's/_/./g') fi -for chkdir in machine/../../.. .. ../.. ../../.. /usr/src; do - if [ -f ${chkdir}/sys/conf/subvers-${SHORTTAG} ]; then - SUBVER=$(tail -1 ${chkdir}/sys/conf/subvers-${SHORTTAG} | awk '{ print $1; }') - if [ "X${SUBVER}" != "X" ]; then - REVISION="${REVISION}.${SUBVER}" - break - fi +if [ -f ${SRCDIR}/sys/conf/subvers-${SHORTTAG} ]; then + SUBVER=$(tail -1 ${SRCDIR}/sys/conf/subvers-${SHORTTAG} | awk '{ print $1; }') + if [ "X${SUBVER}" != "X" ]; then + REVISION="${REVISION}.${SUBVER}" + break fi -done +fi RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" @@ -81,24 +86,19 @@ if [ "X${PARAMFILE}" != "X" ]; then ${PARAMFILE}) else RELDATE=$(awk '/__DragonFly_version.*propagated to newvers/ {print $3}' \ - $(dirname $0)/../sys/param.h) + ${SRCDIR}/sys/sys/param.h) fi -b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template -for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b -do - if [ -r "$bsd_copyright" ]; then - COPYRIGHT=`sed \ - -e "s/\[year\]/$year/" \ - -e 's/\[your name\]\.*/The DragonFly Project/' \ - -e '/\[id for your version control system, if any\]/d' \ - $bsd_copyright` - break - fi -done +if [ -r ${SRCDIR}/share/examples/etc/bsd-style-copyright ]; then + COPYRIGHT=`sed \ + -e "s/\[year\]/$year/" \ + -e 's/\[your name\]\.*/The DragonFly Project/' \ + -e '/\[id for your version control system, if any\]/d' \ + ${SRCDIR}/share/examples/etc/bsd-style-copyright` +fi # no copyright found, use a dummy if [ X"$COPYRIGHT" = X ]; then -- 2.41.0