From: Zac Medico Date: Thu, 20 Dec 2007 04:00:24 +0000 (-0000) Subject: Bug #202748 - When merging a binary package, only clean up X-Git-Tag: v2.2_pre1~155 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dcb33edbdf01256d2f2cb3f40cf0fa7ecbb0f470;p=portage.git Bug #202748 - When merging a binary package, only clean up temp files on success. Otherwise, leave the temp files intact for debugging purposes. svn path=/main/trunk/; revision=8971 --- diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 0894dac0c..1c9956336 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5802,6 +5802,7 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes mycat = None mypkg = None did_merge_phase = False + success = False try: """ Don't lock the tbz2 file because the filesytem could be readonly or shared by a cluster.""" @@ -5879,6 +5880,7 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes retval = mylink.merge(pkgloc, infloc, myroot, myebuild, cleanup=0, mydbapi=mydbapi, prev_mtimes=prev_mtimes) did_merge_phase = True + success = retval == os.EX_OK return retval finally: mysettings.pop("PORTAGE_BINPKG_FILE", None) @@ -5892,7 +5894,8 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes from portage.elog import elog_process elog_process(mycat + "/" + mypkg, mysettings) try: - shutil.rmtree(builddir) + if success: + shutil.rmtree(builddir) except (IOError, OSError), e: if e.errno != errno.ENOENT: raise