Subject: Re: pkgsrc locking is still broken!
To: Raymond Meyer <raymond.meyer@rambler.ru>
From: Roland Illig <rillig@NetBSD.org>
List: pkgsrc-users
Date: 05/12/2007 23:20:59
Raymond Meyer wrote:
> On Fri, 11 May 2007 10:40:41 +0200
> Roland Illig <rillig@NetBSD.org> wrote:
> 
> 
>>$ cd pkgsrc/x11/gtk2
>>$ make help topic=locking
>>$ make help topic=wrkdir_locktype
>>
>>(The recommended setting for WRKDIR_LOCKTYPE is "once", not "sleep".)
>>
>>Roland
> 
> 
> I set PKGSRC_LOCKTYPE=sleep because I don't want one of the processes to exit.
> If multiple processes try to build the same package, they will acquire a lock
> and sleep until the package has been built, then they should continue building
> any dependant packages. Well that's the theory.

In practice, this is not yet implemented. And until that is done, it is 
better to exit when two packages are being _built_ (not installed) at 
the same time. The scenario is this:

[1] locking $package
[1] building $package
[2] waiting for a lock for $package
[1] installing $package
[1] packaging $package
[1] cleaning $package
...
At this point, the package is installed and the working directory is 
cleaned up. Pkgsrc would behave unexpectedly if [2] would now try to 
build and install the package again. (Installing the package would fail 
because it is already installed.)

> What's the difference between PKGSRC_LOCKTYPE, WRKDIR_LOCKTYPE and
> LOCALBASE_LOCKTYPE? And what do you mean by "recommended" setting? If other
> settings are allowed but they break pkgsrc locking, then they shouldn't be
> allowed.

PKGSRC_LOCKTYPE is the old variable that affects both WRKDIR and 
LOCALBASE. After some thinking I realized that I wanted to have 
different locking styles for LOCALBASE and WRKDIR, so I split that 
variable into WRKDIR_LOCKTYPE and LOCALBASE_LOCKTYPE. For compatibility 
reasons, I kept the setting of PKGSRC_LOCKTYPE as the default value for 
these two variables.

See also:
* http://mail-index.netbsd.org/pkgsrc-changes/2007/02/20/0089.html

Roland