Is it safe to compile multiple ports at the same time ?

Vasil Dimov vd at
Wed May 17 06:00:39 UTC 2006

On Wed, May 17, 2006 at 03:08:07PM +1000, Paul Koch wrote:
> On Wed, 17 May 2006 02:54 pm, Edwin Groothuis wrote:
> > On Wed, May 17, 2006 at 01:53:37PM +1000, Paul Koch wrote:
> > > Is it safe to compile multiple ports at the same time and not get
> > > the makes to run into each other when building dependency ports ?
> >
> > I once submitted a patch which checked for this. Now that I've
> > learned about lockf(1) I think there is a chance a next one will
> > be approved too!
> >
> > Edwin
> So.... it would be nice to have some type of locking in the ports build.  
> For example, when a make enters /usr/ports/{category}/{port}, it gets 
> an exclusive lock on that port (maybe on the Makefile itself, or a 
> specific lock file) before it attempts to build/install the port.  It 
> could be done by using lockf, but that just forks more processes, and 
> there are already lots of them. I'd dare to say.... maybe it could be a 
> function of make itself. As in, extend make so it understands a new 
> keyword that makes it get an exclusive lock, using flock(2).  
> With locking, you should then be able to fire off lots of port builds 
> and use up all those cpu cores :)

Not really, locking will just prevent breakages. Let me illustrate my
thought with an example:

port A depends on X
port B depends on X

You start building A which results in building X via exclusive lock on X.
During the build of X you decide to build B which results in building X
(X is not yet installed) but you block trying to acquire the exclusive
lock on X so you wait _idling_ until building of X is done. Furthermore
what do you suggest to do when the lock is released?

Ofcourse if B depends also on Y it can fallback to building Y if it
cannot gain exclusive lock on X.

Vasil Dimov
gro.DSBeerF at dv

Testing can show the presence of bugs, but not their absence.
                -- Edsger W. Dijkstra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
Url :

More information about the freebsd-ports mailing list