Bug #202748 - When merging a binary package, only clean up
authorZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 04:00:24 +0000 (04:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 04:00:24 +0000 (04:00 -0000)
temp files on success. Otherwise, leave the temp files
intact for debugging purposes.

svn path=/main/trunk/; revision=8971

pym/portage/__init__.py

index 0894dac0c3bef53b29e1b976aa3c1ad94c6afe35..1c995633644ae2b5c767bd409005bd357361c8c6 100644 (file)
@@ -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