Bug #253210 - Fix logic inside EbuildBuild._buildpkg_exit() to avoid
authorZac Medico <zmedico@gentoo.org>
Mon, 12 Jan 2009 08:11:17 +0000 (08:11 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 12 Jan 2009 08:11:17 +0000 (08:11 -0000)
triggering an AssertionError when the package phase has failed. This
bug usually isn't noticeable since the package phase usually succeeds.
(trunk r12371)

svn path=/main/branches/2.1.6/; revision=12442

pym/_emerge/__init__.py

index 4b8887bc975780f13354759a064ab8b5ab133efc..dffc05ea78b310d6b8a2435b20b4fd5aab6e5706 100644 (file)
@@ -2658,8 +2658,12 @@ class EbuildBuild(CompositeTask):
                be released when merge() is called.
                """
 
-               if self._default_exit(packager) == os.EX_OK and \
-                       self.opts.buildpkgonly:
+               if self._default_exit(packager) != os.EX_OK:
+                       self._unlock_builddir()
+                       self.wait()
+                       return
+
+               if self.opts.buildpkgonly:
                        # Need to call "clean" phase for buildpkgonly mode
                        portage.elog.elog_process(self.pkg.cpv, self.settings)
                        phase = "clean"
@@ -2670,9 +2674,10 @@ class EbuildBuild(CompositeTask):
                        self._start_task(clean_phase, self._clean_exit)
                        return
 
-               if self._final_exit(packager) != os.EX_OK or \
-                       self.opts.buildpkgonly:
-                       self._unlock_builddir()
+               # Continue holding the builddir lock until
+               # after the package has been installed.
+               self._current_task = None
+               self.returncode = packager.returncode
                self.wait()
 
        def _clean_exit(self, clean_phase):