Subject: Re: Source code nfs share setup
To: NetBSD netbsd-help mailing list <netbsd-help@netbsd.org>
From: Julian Coleman <jdc@coris.org.uk>
List: netbsd-help
Date: 01/03/2004 20:18:43
> Can someone direct me to documentation on correct
> setup for a NetBSD src share for multiple machines
> building possibly at the same time?
> 
> I've been searching and can't find anything. It would
> be nice if this subject was covered in the online doc
> somewhere.
> 
> I know NFS fairly well, but I'm wondering if there are
> any "gotchas" specific to this task.

I think the main thing is to have the source mounted read-only on all the
machines that you do a build on.  This stops an accidental write into the
sources from one machine affecting the others.

My setup is:

  NFS server with:
    /dev/sd0h       /srcs           ffs     rw,nodev,nosuid         0       2
    /srcs/current/src       /usr/src                null    ro
    /srcs/pkgsrc            /usr/pkgsrc             null    ro
    /srcs/xsrc              /usr/xsrc               null    ro
    (/srcs is exported to all machines)

  NFS clients with
    server:/srcs/current/src       /usr/src                nfs     ro,-b
    server:/srcs/xsrc              /usr/xsrc               nfs     ro,-b
    server:/srcs/pkgsrc            /usr/pkgsrc             nfs     ro,-b

When I build the world, I set:

  MAKEOBJDIRPREFIX=/usr/obj/$DESTARCH
  TOOLDIR=$MAKEOBJDIRPREFIX/usr/src/tools/tools.`uname -s`-`uname -r`-$ARCH

where $DESTARCH is the architecture I'm building and $ARCH is the local
architecture (these could be different for cross builds, e.g. ARCH=alpha,
DESTARCH=atari).  This separates all the builds into /usr/obj/$DESTARCH,
as some machines share the same /usr/obj (e.g. all the sparcs).

When I build a package, I set:

  WRKOBJDIR?=/usr/obj/pkg/${MACHINE_ARCH}

in /etc/mk.conf, so that all packages are separated by architecture.  One
snag with a read only pkgsrc is that you must do all the package fetches on
the server.  I do this by running:

  make fetch-list-recursive

on the packages that I want to build, so that I have all the distfiles before
I start.  Some packages have different files for different architectures, so
you'll also need:

  make MACHINE_ARCH=$DESTARCH fetch-list-recursive

to make the list of the other architectures.  I then fetch all the files into
/srcs/pkgsrc/distfiles.  One other way would be to have /usr/pkgsrc/distfiles
be a symbolic link into a shared read-write directory.

J

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/