summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-10-07 08:40:33 +0000
committerZac Medico <zmedico@gentoo.org>2008-10-07 08:40:33 +0000
commit846ca7d3589ed0e294b8a97c30726267b306a22c (patch)
treebdf47d20e1939a03f02760e6f08f3b2fbff4ce95
parentded1a397f2d0eecbf24caa8d9dbfda843765b5ac (diff)
downloadportage-846ca7d3589ed0e294b8a97c30726267b306a22c.tar.gz
portage-846ca7d3589ed0e294b8a97c30726267b306a22c.tar.bz2
portage-846ca7d3589ed0e294b8a97c30726267b306a22c.zip
Make EbuildFetcher direct fetch output to the normal build log. By keeping the
output in the build log instead of the global emerge-fetch.log file, output from a possible fetch failure can be recovered and displayed later. TODO: Convert failed fetch to elog message as suggested in bug #234301. svn path=/main/trunk/; revision=11647
-rw-r--r--pym/_emerge/__init__.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index cffaf5426..6a92fc952 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -2249,6 +2249,15 @@ class EbuildFetcher(SpawnProcess):
settings = self.config_pool.allocate()
self._build_dir = EbuildBuildDir(pkg=self.pkg, settings=settings)
self._build_dir.lock()
+
+ if self.background and self.logfile is None:
+ fetch_log = None
+ if not self.fetchonly:
+ fetch_log = settings.get("PORTAGE_LOG_FILE")
+ if fetch_log is None:
+ fetch_log = self.scheduler.fetch.log_file
+ self.logfile = fetch_log
+
phase = "fetch"
if self.fetchall:
phase = "fetchall"
@@ -2275,21 +2284,22 @@ class EbuildFetcher(SpawnProcess):
self.env = fetch_env
SpawnProcess._start(self)
- def _wait_hook(self):
+ def _set_returncode(self, wait_retval):
+ SpawnProcess._set_returncode(self, wait_retval)
# Collect elog messages that might have been
# created by the pkg_nofetch phase.
if self._build_dir is not None:
portage.elog.elog_process(self.pkg.cpv, self._build_dir.settings)
- try:
- shutil.rmtree(self._build_dir.settings["PORTAGE_BUILDDIR"])
- except EnvironmentError, e:
- if e.errno != errno.ENOENT:
- raise
- del e
+ if self.returncode == os.EX_OK:
+ try:
+ shutil.rmtree(self._build_dir.settings["PORTAGE_BUILDDIR"])
+ except EnvironmentError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ del e
self._build_dir.unlock()
self.config_pool.deallocate(self._build_dir.settings)
self._build_dir = None
- SpawnProcess._wait_hook(self)
class EbuildBuildDir(SlotObject):
@@ -2322,6 +2332,7 @@ class EbuildBuildDir(SlotObject):
portage.doebuild_environment(ebuild_path, "setup", root_config.root,
self.settings, debug, use_cache, portdb)
dir_path = self.settings["PORTAGE_BUILDDIR"]
+ portage.prepare_build_dirs(self.pkg.root, self.settings, 0)
catdir = os.path.dirname(dir_path)
self._catdir = catdir
@@ -2432,8 +2443,6 @@ class EbuildBuild(CompositeTask):
return
fetch_log = None
- if self.background:
- fetch_log = self.scheduler.fetch.log_file
fetcher = EbuildFetcher(config_pool=self.config_pool,
fetchall=opts.fetch_all_uri,