doebuild: cleanup tempfile if package phase fails
authorZac Medico <zmedico@gentoo.org>
Sun, 22 Apr 2012 22:11:16 +0000 (15:11 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 22 Apr 2012 22:11:16 +0000 (15:11 -0700)
pym/portage/package/ebuild/doebuild.py

index 29bef0917a711c352767b4a18f367c60cba71d93..da30bda38532b5d189de8af7a2ba7d9597480ad0 100644 (file)
@@ -1040,6 +1040,13 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
                                if mydo == "package" and bintree is not None:
                                        bintree.inject(mysettings.mycpv,
                                                filename=mysettings["PORTAGE_BINPKG_TMPFILE"])
+                       else:
+                               if "PORTAGE_BINPKG_TMPFILE" in mysettings:
+                                       try:
+                                               os.unlink(mysettings["PORTAGE_BINPKG_TMPFILE"])
+                                       except OSError:
+                                               pass
+
                elif mydo=="qmerge":
                        # check to ensure install was run.  this *only* pops up when users
                        # forget it and are using ebuild