Subject: Re: how to install -current?
To: Luke Mewburn <lukem@netbsd.org>
From: Steven M. Bellovin <smb@research.att.com>
List: current-users
Date: 01/21/2003 18:04:01
In message <20030121224225.GA3257@mewburn.net>, Luke Mewburn writes:
>On Tue, Jan 21, 2003 at 04:49:35PM -0500, Steve Bellovin wrote:
>  | Given the problems sometimes reported in building -current, I prefer to 
>  | do my compilation while still running the old system, so that I can do 
>  | other things.
>  | 
>  | 	./build.sh -D /usr/netbsd
>  | 
>  | (Stand back, wait a while.)
>
>This is sensible!  This is, IMNSHO, the ONLY way to update. 
>You've hit the minor hitch with the scheme ...
>
>
>  | Great; it built.  I reboot to single-user with the new kernel, and try 
>  | to install:
>  | 
>  | 	./build.sh -D /usr/netbsd -i /
>  | 
>  | It's recompiling the world...
>
>Yes; '-i ...' is performed after all the other operations.
>The default operation is "make build", and unless you have UPDATE
>set (or use build.sh -u), one of the the first things "make build"
>does is "make clean".  Which removes all your hard work from the first
>pass :-(
>
>There's a couple of solutions:
>	./build.sh -D /usr/netbsd -b -i /
>
>    (`-b' only builds the "make" wrapper scripts, and doesn't do the
>    "make build" step.  the documentation of this should be improved)
>
>	./build.sh -D /usr/netbsd -u -b -i /
>
>    (still does the "make build", but with "UPDATE" set, so the
>    "make clean" doesn't run)
>
>
>BTW: Where are you looking for your instructions on building? 
>I would like to ensure that the various instructions on how to
>build in the source and on www.netbsd.org provide useful and
>consistent information, and it seems that we're probably
>deficient in that at this time.
>
/usr/src/BUILDING, though I can't check my -current copy right now 
because that machine is still rebuilding the world while in single-user 
mode....

What's missing from that document is examples; there's too much 
knowledge assumed of the oral tradition.  (And that says nothing of 
downright ambiguities.  For example (and again, this is 1.6 I'm 
referring to), '-u' is described as "sets the UPDATE variable".  The 
description of UPDATE is less than clear.  Under "full builds", it says 
that it skips the "make cleandir", which is good.  But the other 
description of UPDATE says that it compares file timestamps before 
installing to DESTDIR.  Well, maybe that's good, but I suspect that the 
copies to DESTDIR are the least of the expense; it's all the 
compilations.  And "make" is very good at comparing timestamps, if 
given half a chance.  In other words, UPDATE isn't described very 
well...  

The documentation on building the toolchain is similarly obscure.  If I 
think the tools haven't changed -- the usual case, if I haven't gone 
very long since the last time I build the world -- I *think* I need -T, 
but -t and -b seem to be in that space, too, though I *thinkI* I never 
want them...

There are also problems with the script itself.  I'd have used 
make-like semantics for -i, for example.  Have the build process create 
$DESTDIR/Built after successful completion of a complete build; -i 
would check for it (rather than rebuilding the world -- if I want to 
build+install, maybe I'll just set DESTDIR to / :) ), and more or less 
anything else would remove Built.  Then there's DESTDIR, which is 
overloaded.  I can (and do) have OBJDIR in /etc/mk.conf; I can't do the 
same for DESTDIR, because the package system seems to use it, which 
confused me a few weeks ago.  Beyond that, I suspect there are too many 
dubious options, but I'll let that go...  Again, what's really needed 
are some examples for the most common cases.  The complex cases need 
less documentation; folks who need those options tend to know what 
they're doing...


		--Steve Bellovin, http://www.research.att.com/~smb (me)
		http://www.wilyhacker.com (2nd edition of "Firewalls" book)