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

Wesley Shields wxs at
Wed May 17 12:38:15 UTC 2006

On Wed, May 17, 2006 at 09:13:37AM -0300, Fernan Aguero wrote:
> +----[ Edwin Groothuis <edwin at> (17.May.2006 03:16):
> |
> | You have to obtain a lock on the X's Makefile before you are doing
> | to check if you have this port installed.
> | 
> | For example, a dependcy on pkg-config in the directory devel/pkgconfig:
> | 
> | - obtain lock on devel/pkgconfig/Makefile
> | - check if pkg-config exists, and if not, build and install it.
> | - release lock on devel/pkgconfig/Makefile
> | 
> |
> +----]
> Why not
> - check if pkg-config exists and only if it doesn't exist,
>   try to obtain lock on the lock target.

Because at that point aren't you in a race condition?

Port A finds out pkg-config doesn't exist.
Port B finds out pkg-config doesn't exist.

At this point both ports determine they need to build and install the

Port B manages to obtain the lock first, and builds and installs
Port A waits on Port B to finish.
Upon finishing Port A obtains the lock and builds and attempts to
install an already installed port.

You must obtain the lock early on, like Edwin has stated.

-- WXS

More information about the freebsd-ports mailing list