From: Zac Medico Date: Wed, 2 Jul 2008 08:21:20 +0000 (-0000) Subject: Remove $PORTAGE_BUILDDIR locking from portage.pkgmerge() and use X-Git-Tag: v2.2_rc2~243 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d067203492b79f51319d21f0daaddbf44ece33d4;p=portage.git Remove $PORTAGE_BUILDDIR locking from portage.pkgmerge() and use an instance of EbuildBuildDir instead. svn path=/main/trunk/; revision=10892 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index a2dc88b1a..225a4c4d6 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2124,12 +2124,18 @@ class Binpkg(SlotObject): short_msg = "emerge: (%s of %s) %s Merge Binary" % \ (pkg_count.curval, pkg_count.maxval, pkg.cpv) logger.log(msg, short_msg=short_msg) - merge = BinpkgMerge(find_blockers=find_blockers, - ldpath_mtimes=ldpath_mtimes, pkg=pkg, pretend=opts.pretend, - pkg_path=pkg_path, settings=settings) - retval = merge.execute() - if retval != os.EX_OK: - return retval + + build_dir = EbuildBuildDir(pkg=pkg, settings=settings) + try: + build_dir.lock() + merge = BinpkgMerge(find_blockers=find_blockers, + ldpath_mtimes=ldpath_mtimes, pkg=pkg, pretend=opts.pretend, + pkg_path=pkg_path, settings=settings) + retval = merge.execute() + if retval != os.EX_OK: + return retval + finally: + build_dir.unlock() return os.EX_OK class BinpkgFetcher(Task): diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 6cba85bf7..5fe2b41f3 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -6589,8 +6589,6 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, return 1 tbz2_lock = None - builddir_lock = None - catdir_lock = None mycat = None mypkg = None did_merge_phase = False @@ -6622,11 +6620,6 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, catdir_lock = portage.locks.lockdir(catdir) portage.util.ensure_dirs(catdir, uid=portage_uid, gid=portage_gid, mode=070, mask=0) - builddir_lock = portage.locks.lockdir(builddir) - try: - portage.locks.unlockdir(catdir_lock) - finally: - catdir_lock = None try: shutil.rmtree(builddir) except (IOError, OSError), e: @@ -6678,7 +6671,7 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, mysettings.pop("PORTAGE_BINPKG_FILE", None) if tbz2_lock: portage.locks.unlockfile(tbz2_lock) - if builddir_lock: + if True: if not did_merge_phase: # The merge phase handles this already. Callers don't know how # far this function got, so we have to call elog_process() here @@ -6692,21 +6685,6 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, if e.errno != errno.ENOENT: raise del e - portage.locks.unlockdir(builddir_lock) - try: - if not catdir_lock: - # Lock catdir for removal if empty. - catdir_lock = portage.locks.lockdir(catdir) - finally: - if catdir_lock: - try: - os.rmdir(catdir) - except OSError, e: - if e.errno not in (errno.ENOENT, - errno.ENOTEMPTY, errno.EEXIST): - raise - del e - portage.locks.unlockdir(catdir_lock) def deprecated_profile_check(): if not os.access(DEPRECATED_PROFILE_FILE, os.R_OK):