Refactor the client-side. It turns out that the evaluation of param.h

was being done before the src tree had been mounted.

This was not a problem in the old codebase, since it simply got the
wrong src tree to start with.

This actually simplifies the code.
This commit is contained in:
Mark Linimon 2010-12-16 07:38:18 +00:00
parent b0a015135a
commit 6f337f74cd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=266405

View file

@ -62,6 +62,23 @@ resolve() {
echo ${buildid}
}
# derive the source tree metadata and export it. common to both client and server.
export_src_metadata() {
src_base=$1
if [ -f ${src_base}/sys/sys/param.h ]; then
export OSVERSION=$(awk '/^#define __FreeBSD_version/ {print $3}' < ${src_base}/sys/sys/param.h)
else
echo "export_src_metadata: couldn't find ${src_base}/sys/sys/param.h!"
fi
if [ -f ${src_base}/sys/conf/newvers.sh ]; then
export OSREL=$(awk 'BEGIN {FS="\""}; /^REVISION/ {print $2}' < ${src_base}/sys/conf/newvers.sh)
export BRANCH=$(awk 'BEGIN {FS="\""}; /^BRANCH/ {print $2}' < ${src_base}/sys/conf/newvers.sh)
else
echo "export_src_metadata: couldn't find ${src_base}/sys/conf/newvers.sh!"
fi
}
#
# establish commonly-used environment variables (server-side)
#
@ -89,6 +106,7 @@ buildenv () {
else
export SRC_BASE=/nonexistent
fi
export_src_metadata ${SRC_BASE}
# for archs that support COMPAT_IA32, set some flags for INDEX.
# Client kernels should be built appropriately.
@ -106,7 +124,7 @@ buildenv () {
fi
done
buildenv.common ${pb} ${arch} ${branch} ${builddir}
buildenv.common
# override things destined for bsd.port.mk
export DISTDIR=${builddir}/distfiles
@ -128,12 +146,8 @@ buildenv () {
# establish commonly-used environment variables (client-side)
#
buildenv.client() {
pb=$1
arch=$2
branch=$3
builddir=$4
buildenv.common ${pb} ${arch} ${branch} ${builddir}
# derive OSREL, OSVERSION, and BRANCH
export_src_metadata $1
# manually override results of uname(1)
export UNAME_m=${ARCH}
@ -148,19 +162,6 @@ buildenv.client() {
# establish commonly-used environment variables (common to clients and server)
#
buildenv.common() {
pb=$1
arch=$2
branch=$3
builddir=$4
if [ -f ${SRC_BASE}/sys/sys/param.h ]; then
export OSVERSION=$(awk '/^#define __FreeBSD_version/ {print $3}' < ${SRC_BASE}/sys/sys/param.h)
fi
if [ -f ${SRC_BASE}/sys/conf/newvers.sh ]; then
export OSREL=$(awk 'BEGIN {FS="\""}; /^REVISION/ {print $2}' < ${SRC_BASE}/sys/conf/newvers.sh)
export BRANCH=$(awk 'BEGIN {FS="\""}; /^BRANCH/ {print $2}' < ${SRC_BASE}/sys/conf/newvers.sh)
fi
export ARCH=${arch}
export MACHINE_ARCH=${arch}