Date: Wed, 12 Dec 2012 09:53:51 -0700 From: Ian Lepore <freebsd@damnhippie.dyndns.org> To: Kimmo Paasiala <kpaasial@gmail.com> Cc: freebsd-current@freebsd.org, freebsd-stable@freebsd.org Subject: Re: /usr/src/sys/conf/newvers.sh, SYSDIR set to wrong directory. Message-ID: <1355331231.87661.461.camel@revolution.hippie.lan> In-Reply-To: <CA%2B7WWSew50m%2Bq20EJXZuhJZDnM%2B--tudetESRE2y9RN5-8fwHw@mail.gmail.com> References: <CA%2B7WWSew50m%2Bq20EJXZuhJZDnM%2B--tudetESRE2y9RN5-8fwHw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2012-12-12 at 18:14 +0200, Kimmo Paasiala wrote:
> Hello,
>
> My 9-STABLE buildworld broke in a very inexplicable way, I was
> getting an error on /usr/src/include/osreldate.h that I couldn't
> figure out until I started looking at the sys/conf/newvers.sh and what
> it does. It turned out that the thing that broke my buildworld was
> having .git directory at the root directory of the system because I
> recently started using GIT to track the configuration files.
>
> I added some debug echos to the newvers.sh and I found out it's
> setting SYSDIR to /bin/.. which in turn causes the newvers.sh to set
> the gitdir to /.git and that seems to break the logic in newvers.sh.
>
> Isn't SYSDIR supposed to be set to the sys -subdirectory of the source
> tree (/usr/src/sys default)?
>
> I'm guessing the reason the SYSDIR gets set to /bin/.. is the line in
> newvers.sh:
>
> SYSDIR=$(dirname $0)/..
>
> $0 is actually /bin/sh and not the path to newver.sh because the
> newvers.sh is sourced by the Makefile in /usr/src/include instead of
> executing it:
>
> osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
> ${.CURDIR}/Makefile
> @${ECHO} creating osreldate.h from newvers.sh
> @MAKE=${MAKE}; \
> PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
> . ${.CURDIR}/../sys/conf/newvers.sh; \
>
> Now the question is how to fix this?
>
> -Kimmo
Perhaps it could be handled similar to PARAMFILE, something like this in
the makefile:
PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
SYSDIR=${.CURDIR}/../sys; \
. ${.CURDIR}/../sys/conf/newvers.sh; \
I'm not sure if newvers.sh needs to work in ways that don't involve
being invoked from that makefile rule, so to be safe it could have
default handling, something like:
: ${SYSDIR:=$(dirname $0)/..}
-- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1355331231.87661.461.camel>
