From: Zac Medico Date: Thu, 17 Nov 2011 03:43:00 +0000 (-0800) Subject: pkg_pretend: tweak final cleanup logic X-Git-Tag: v2.2.0_alpha75~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b552912a54d0240325c1b3b8bef744ea04a513f8;p=portage.git pkg_pretend: tweak final cleanup logic This ensures that the clean phase will not run if the user interrupts emerge before the build dir is locked. --- diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index fb8fdfb73..261fa9569 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -923,13 +923,12 @@ class Scheduler(PollScheduler): os.path.realpath(settings["PORTAGE_TMPDIR"]), "portage", x.category, x.pf) existing_buildir = os.path.isdir(build_dir_path) - build_dir = None + settings["PORTAGE_BUILDDIR"] = build_dir_path + build_dir = EbuildBuildDir(scheduler=sched_iface, + settings=settings) + build_dir.lock() try: - settings["PORTAGE_BUILDDIR"] = build_dir_path - build_dir = EbuildBuildDir(scheduler=sched_iface, - settings=settings) - build_dir.lock() # Clean up the existing build dir, in case pkg_pretend # checks for available space (bug #390711). @@ -1005,12 +1004,11 @@ class Scheduler(PollScheduler): failures += 1 portage.elog.elog_process(x.cpv, settings) finally: - if build_dir is not None: - clean_phase = EbuildPhase(background=False, - phase='clean', scheduler=sched_iface, settings=settings) - clean_phase.start() - clean_phase.wait() - build_dir.unlock() + clean_phase = EbuildPhase(background=False, + phase='clean', scheduler=sched_iface, settings=settings) + clean_phase.start() + clean_phase.wait() + build_dir.unlock() if failures: return 1