Inside dblink._merge(), make sure PORTAGE_BUILDDIR still exists before trying
authorZac Medico <zmedico@gentoo.org>
Mon, 7 Dec 2009 02:30:55 +0000 (02:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 7 Dec 2009 02:30:55 +0000 (02:30 -0000)
to call ebuild success/die hooks, since it might have already been removed
by fail-clean (and the hooks would have already been called). (trunk r14953)

svn path=/main/branches/2.1.7/; revision=14954

pym/portage/dbapi/vartree.py

index 21a2fa90ac84657518997118c3d2437933f89b86..9793514a0ea841c8cfaac636ef70d6df634ec14b 100644 (file)
@@ -3245,17 +3245,23 @@ class dblink(object):
                        retval = self.treewalk(mergeroot, myroot, inforoot, myebuild,
                                cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes)
 
-                       if retval == os.EX_OK:
-                               phase = 'success_hooks'
-                       else:
-                               phase = 'die_hooks'
+                       # If PORTAGE_BUILDDIR doesn't exist, then it probably means
+                       # fail-clean is enabled, and the success/die hooks have
+                       # already been called by _emerge.EbuildPhase (via
+                       # self._scheduler.dblinkEbuildPhase) prior to cleaning.
+                       if os.path.isdir(self.settings['PORTAGE_BUILDDIR']):
+
+                               if retval == os.EX_OK:
+                                       phase = 'success_hooks'
+                               else:
+                                       phase = 'die_hooks'
 
-                       if self._scheduler is None:
-                               portage._spawn_misc_sh(self.settings, [phase],
-                                       phase=phase)
-                       else:
-                               self._scheduler.dblinkEbuildPhase(
-                                       self, mydbapi, myebuild, phase)
+                               if self._scheduler is None:
+                                       portage._spawn_misc_sh(self.settings, [phase],
+                                               phase=phase)
+                               else:
+                                       self._scheduler.dblinkEbuildPhase(
+                                               self, mydbapi, myebuild, phase)
 
                        # Process ebuild logfiles
                        elog_process(self.mycpv, self.settings, phasefilter=filter_mergephases)