diff options
-rw-r--r-- | pym/portage/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 |