From 8cf8f3ebbd5682428448f41e9fb4a43707fd5b3e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 20 Dec 2007 04:02:21 +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. (trunk r8971) svn path=/main/branches/2.1.2/; revision=8972 --- pym/portage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage.py b/pym/portage.py index 1a05a0712..bf27c1fa5 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -9439,6 +9439,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.""" @@ -9516,6 +9517,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) @@ -9528,7 +9530,8 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes # so that it's only called once. 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