From dcb33edbdf01256d2f2cb3f40cf0fa7ecbb0f470 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 20 Dec 2007 04:00:24 +0000 Subject: [PATCH] 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 --- pym/portage/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.26.2