It would be nice for emerge --sync to be ignored/delayed when an active merge is happening. The user facing problem is when you are compiling something and then an emerge --sync is ran (probably from cron) which invalidates your work at the next phase when the Manifest is re-checked. A discussed feature/workaround for this would be to make emerge --sync respect a lockfile or so. In this fashion, a long compile job would *not* get halted in the middle. Think about someone making a whitespace change that invalidates the 3+ hour compilation job. This is annoying to the end user, admittedly slightly rare occurrence.
Maybe we can modify the portage.locks module to optionally use fcntl.LOCK_SH instead of LOCK_EX, or add a new function to do that if it doesn't fit the existing functions well.
via flock, a LOCK_SH for readonly access, LOCK_EX for write access (sync'ing) applied to the repository directory (PORTDIR=/usr/portage, thus /usr/portage) would work for me in terms of pkgcore/portage interop. Work for you?
If you have a lot of repos configured, and you have a build plan that uses lots of them, then you're going to have to hold individual shared locks for each repo that you're using until you're finished with it. Alternatively we could go with a single global lock, like /var/lock/portage_repos or something like that, but maybe that's not granular enough for some use cases? If using a global lock, might also want to consider permissions issues. For example, with prefix-portage, the user may not have write access to the global /var/lock directory, but they still may want use this locking feature. In that case maybe it would make sense for them to use $EPREFIX/var/lock for such locks.
(In reply to comment #3) > If you have a lot of repos configured, and you have a build plan that uses lots > of them, then you're going to have to hold individual shared locks for each > repo that you're using until you're finished with it. > > Alternatively we could go with a single global lock, like > /var/lock/portage_repos or something like that, but maybe that's not granular > enough for some use cases? If using a global lock, might also want to consider > permissions issues. For example, with prefix-portage, the user may not have > write access to the global /var/lock directory, but they still may want use > this locking feature. In that case maybe it would make sense for them to use > $EPREFIX/var/lock for such locks. locking per repo suffices, although keep in mind that overlay repo's would need to lock what their 'overlaying' since eclasses and other bits can come from there. While this can result in long held locks... that's valid. You don't want a sync leveled during a 100 pkg build after all.