Subject: Re: pkgsrc: WRKDIR / NFS-mounted pkgsrc
To: NetBSD User's Discussion List <netbsd-users@NetBSD.ORG>
From: Florian Stoehr <netbsd@wolfnode.de>
List: netbsd-users
Date: 12/23/2004 00:30:20
On Wed, 22 Dec 2004, Greg A. Woods wrote:

> [ On Wednesday, December 22, 2004 at 12:11:39 (+0100), Florian Stoehr wrote: ]
>> Subject: pkgsrc: WRKDIR / NFS-mounted pkgsrc
>>
>> I need to run pkgsrc build from various machines and architectures in
>> parallel.
>
> Since each of my machines might have a different filesystem on which I
> want to do package builds, I use a common WRKOBJDIR that is a symlink
> which can be re-directed on each build machine as desired:
>
> 	WRKOBJDIR =	/var/package-obj
>
> In fact I modified pkgsrc/mk/bsd.pkg.defaults.mk to do this so that I
> don't have to worry about setting it in /etc/mk.conf on each build
> machine:
>
> 	WRKOBJDIR?=	/var/package-obj
> 	# build here instead of in pkgsrc
> 	# Possible: any path you like (can be a symlink)
> 	# Note: must remain constant for all hosts sharing pkgsrc
> 	# Default: /var/package-obj
>
> This makes is possible to have the "work" symlinks created in the source
> tree and then still have them work on every machine that mounts the
> source tree (though the symlinks do of course have to be created with
> the mount in read-write mode, but once created the tree can be mounted
> read-only if desired, though read-only pkgsrc is not nearly so necessary
> as it is for the main system source tree where product files can very
> easily be created in the wrong place if anything goes wrong)
>
> There's no need for any of the ugly OBJMACHINE or OBJHOSTNAME nonsense
> with pkgsrc since there's no possibility of cross-compiling packages.
> I.e. everything's far more flexible if pkgsrc modules contain just one
> single plain "work" symlink in each module that point to/through the
> same directory/symlink in /var on each build host.
>
> (sadly the PKGSRC_LOCKTYPE mechanism depends unnecessarily on
> OBJHOSTNAME, but I don't use it anyway :-)
>
> -- 
> 						Greg A. Woods
>
> +1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
> Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>
>

Thanks for all replies.

I ended up exporting "distfiles" and "pkgsrc" as two NFS-shares (pkgsrc 
read-only), setting "DISTFILES" and "WRKOBJDIR" in every /etc/mk.conf.

So each machine now builds locally on its own but stores downloaded 
distfiles in a central place.

Sure, central working directories (well, per arch) speed up things but as 
I am not sure how this will behave in situations where configure-scripts 
detect different results on different machines (WILL it run configure in 
any case or just leave out the "build" and do the "install" only?), I 
prefer the setup I use now.

I know there might be race conditions with the distfiles, but as I use to 
install a new package on only one machine first, this should be no 
problem.

-Florian