diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-12-06 10:22:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-12-06 10:22:54 +0000 |
commit | d0733a19ea2b08984589c5881b0a99c2ca26e4d6 (patch) | |
tree | d26846c08c46bc51337182743d2e6c513f3b37d7 /pym/_emerge/EbuildPhase.py | |
parent | c37a96a355c769037cf88be5f4638db521122310 (diff) | |
download | portage-d0733a19ea2b08984589c5881b0a99c2ca26e4d6.tar.gz portage-d0733a19ea2b08984589c5881b0a99c2ca26e4d6.tar.bz2 portage-d0733a19ea2b08984589c5881b0a99c2ca26e4d6.zip |
Bug #295715 - Implement a register_success_hook function to complement
register_die_hook, and also add code to ensure the die hooks are called even
when the failure is on the python side (like for file collisions).
svn path=/main/trunk/; revision=14936
Diffstat (limited to 'pym/_emerge/EbuildPhase.py')
-rw-r--r-- | pym/_emerge/EbuildPhase.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py index 01661b2cc..89bdb078f 100644 --- a/pym/_emerge/EbuildPhase.py +++ b/pym/_emerge/EbuildPhase.py @@ -52,12 +52,7 @@ class EbuildPhase(CompositeTask): log_file.close() if self._default_exit(ebuild_process) != os.EX_OK: - if self.phase != 'clean' and \ - 'noclean' not in self.settings.features and \ - 'fail-clean' in self.settings.features: - self._fail_clean() - return - self.wait() + self._die_hooks() return settings = self.settings @@ -92,15 +87,31 @@ class EbuildPhase(CompositeTask): if self._final_exit(post_phase) != os.EX_OK: writemsg("!!! post %s failed; exiting.\n" % self.phase, noiselevel=-1) - if self.phase != 'clean' and \ - 'noclean' not in self.settings.features and \ - 'fail-clean' in self.settings.features: - self._fail_clean() - return + self._die_hooks() + return self._current_task = None self.wait() return + def _die_hooks(self): + self.returncode = None + phase = 'die_hooks' + die_hooks = MiscFunctionsProcess(background=self.background, + commands=[phase], phase=phase, pkg=self.pkg, + scheduler=self.scheduler, settings=self.settings) + self._start_task(die_hooks, self._die_hooks_exit) + + def _die_hooks_exit(self, die_hooks): + if self.phase != 'clean' and \ + 'noclean' not in self.settings.features and \ + 'fail-clean' in self.settings.features: + self._default_exit(die_hooks) + self._fail_clean() + return + self._final_exit(die_hooks) + self.returncode = 1 + self.wait() + def _fail_clean(self): self.returncode = None portage.elog.elog_process(self.pkg.cpv, self.settings) |