diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-09 16:47:45 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-09 16:47:45 -0700 |
commit | 541d2830bf71d7a3f7bb69d739360ef8112ff7b5 (patch) | |
tree | bb8d7b79df256ce42c81ce635d23d0daaef8f15d | |
parent | 09376d04b34066987d4b5b243b215ca6b1c14aed (diff) | |
download | portage-541d2830bf71d7a3f7bb69d739360ef8112ff7b5.tar.gz portage-541d2830bf71d7a3f7bb69d739360ef8112ff7b5.tar.bz2 portage-541d2830bf71d7a3f7bb69d739360ef8112ff7b5.zip |
Bug #336499 - If RESTRICT=fetch is not set but pkg_nofetch is defined,
go ahead and run pkg_nofetch upon fetch failure. This allows specialized
messages to be displayed for problematic packages.
-rw-r--r-- | pym/_emerge/EbuildBuild.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index b319596ac..ecf9f6c43 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -153,8 +153,7 @@ class EbuildBuild(CompositeTask): portage.elog.elog_process(self.pkg.cpv, self.settings) if self._default_exit(fetcher) != os.EX_OK: - self._unlock_builddir() - self.wait() + self._fetch_failed() return # discard successful fetch log @@ -195,6 +194,31 @@ class EbuildBuild(CompositeTask): scheduler=scheduler, settings=settings) self._start_task(build, self._build_exit) + def _fetch_failed(self): + # If RESTRICT=fetch is set, then the nofetch phase + # should have been executed already, so don't do + # it again. + if 'fetch' in self.pkg.metadata.restrict or \ + 'nofetch' not in self.pkg.metadata.defined_phases: + self._unlock_builddir() + self.wait() + return + + # The package has defined a pkg_nofetch phase, even + # though RESTRICT=fetch is not set, so go ahead and + # run it. This allows specialized messages to be + # displayed for problematic packages (bug #336499). + self.returncode = None + nofetch_phase = EbuildPhase(background=self.background, + phase='nofetch', scheduler=self.scheduler, settings=self.settings) + self._start_task(nofetch_phase, self._nofetch_exit) + + def _nofetch_exit(self, nofetch_phase): + self._final_exit(nofetch_phase) + self._unlock_builddir() + self.returncode = 1 + self.wait() + def _unlock_builddir(self): portage.elog.elog_process(self.pkg.cpv, self.settings) self._build_dir.unlock() |