diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-05-07 14:59:54 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-05-07 14:59:54 -0700 |
commit | 8601ea2b80208491b471f37710b35813fd341c28 (patch) | |
tree | afefcbc879800a481e901b866df1ecb011d69a4e /pym | |
parent | 48e1b835df5fefe49e2227e37c007d87fade1c55 (diff) | |
download | portage-8601ea2b80208491b471f37710b35813fd341c28.tar.gz portage-8601ea2b80208491b471f37710b35813fd341c28.tar.bz2 portage-8601ea2b80208491b471f37710b35813fd341c28.zip |
doebuild: use EbuildBuildDir for locking
EbuildBuildDir also performs safe removal of the category when it is
empty, so ebuild.sh/dyn_clean doesn't need to do it anymore. This
fixes a race condition if one process is trying to remove the category
directory while another one is trying to create it for
PORTAGE_BUILDDIR.
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage/package/ebuild/doebuild.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 1c0482224..f83a1e327 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -566,8 +566,19 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, use_cache, mydbapi) if mydo in clean_phases: - return _spawn_phase(mydo, mysettings, - fd_pipes=fd_pipes, returnpid=returnpid) + builddir_lock = None + if not returnpid and \ + 'PORTAGE_BUILDIR_LOCKED' not in mysettings: + builddir_lock = EbuildBuildDir( + scheduler=PollScheduler().sched_iface, + settings=mysettings) + builddir_lock.lock() + try: + return _spawn_phase(mydo, mysettings, + fd_pipes=fd_pipes, returnpid=returnpid) + finally: + if builddir_lock is not None: + builddir_lock.unlock() restrict = set(mysettings.get('PORTAGE_RESTRICT', '').split()) # get possible slot information from the deps file |