summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-10 07:47:45 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-10 07:47:45 +0000
commit7e4eba96e95a11805fe080ccaba3fe8f4470afe4 (patch)
tree9c6c58d068f2dc45ca9780ae845128981cf6cca9
parent29e343606dc7ad72248d7d636dc7c872e01860fa (diff)
downloadportage-7e4eba96e95a11805fe080ccaba3fe8f4470afe4.tar.gz
portage-7e4eba96e95a11805fe080ccaba3fe8f4470afe4.tar.bz2
portage-7e4eba96e95a11805fe080ccaba3fe8f4470afe4.zip
Make the Binpkg class handle fetch logging similar to how EbuildBuild does,
directing output to PORTAGE_LOG_FILE instead of emerge-fetch.log which is only used for prefetchers now. svn path=/main/trunk/; revision=12196
-rw-r--r--pym/_emerge/__init__.py38
1 files changed, 18 insertions, 20 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 720b908d2..4d864d6ca 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -3141,6 +3141,10 @@ class Binpkg(CompositeTask):
self._image_dir = os.path.join(dir_path, "image")
self._infloc = os.path.join(dir_path, "build-info")
self._ebuild_path = os.path.join(self._infloc, pkg.pf + ".ebuild")
+ settings["EBUILD"] = self._ebuild_path
+ debug = settings.get("PORTAGE_DEBUG") == "1"
+ portage.doebuild_environment(self._ebuild_path, "setup",
+ settings["ROOT"], settings, debug, 1, self._bintree.dbapi)
# The prefetcher has already completed or it
# could be running now. If it's running now,
@@ -3180,8 +3184,11 @@ class Binpkg(CompositeTask):
pkg = self.pkg
pkg_count = self.pkg_count
+ if not self.opts.fetchonly:
+ self._build_dir.lock()
+ portage.prepare_build_dirs(self.settings["ROOT"], self.settings, 1)
fetcher = BinpkgFetcher(background=self.background,
- logfile=self.scheduler.fetch.log_file, pkg=self.pkg,
+ logfile=self.settings.get("PORTAGE_LOG_FILE"), pkg=self.pkg,
scheduler=self.scheduler)
pkg_path = fetcher.pkg_path
self._pkg_path = pkg_path
@@ -3193,13 +3200,7 @@ class Binpkg(CompositeTask):
short_msg = "emerge: (%s of %s) %s Fetch" % \
(pkg_count.curval, pkg_count.maxval, pkg.cpv)
self.logger.log(msg, short_msg=short_msg)
-
- if self.background:
- fetcher.addExitListener(self._fetcher_exit)
- self._current_task = fetcher
- self.scheduler.fetch.schedule(fetcher)
- else:
- self._start_task(fetcher, self._fetcher_exit)
+ self._start_task(fetcher, self._fetcher_exit)
return
self._fetcher_exit(fetcher)
@@ -3211,20 +3212,18 @@ class Binpkg(CompositeTask):
if fetcher.returncode is not None:
self._fetched_pkg = True
if self._default_exit(fetcher) != os.EX_OK:
+ self._unlock_builddir()
self.wait()
return
verifier = None
if self._verify:
- verifier = BinpkgVerifier(background=self.background,
- logfile=self.scheduler.fetch.log_file, pkg=self.pkg)
-
+ logfile = None
if self.background:
- verifier.addExitListener(self._verifier_exit)
- self._current_task = verifier
- self.scheduler.fetch.schedule(verifier)
- else:
- self._start_task(verifier, self._verifier_exit)
+ logfile = self.settings.get("PORTAGE_LOG_FILE")
+ verifier = BinpkgVerifier(background=self.background,
+ logfile=logfile, pkg=self.pkg)
+ self._start_task(verifier, self._verifier_exit)
return
self._verifier_exit(verifier)
@@ -3232,6 +3231,7 @@ class Binpkg(CompositeTask):
def _verifier_exit(self, verifier):
if verifier is not None and \
self._default_exit(verifier) != os.EX_OK:
+ self._unlock_builddir()
self.wait()
return
@@ -3255,12 +3255,8 @@ class Binpkg(CompositeTask):
(pkg_count.curval, pkg_count.maxval, pkg.cpv)
logger.log(msg, short_msg=short_msg)
- self._build_dir.lock()
-
phase = "clean"
settings = self.settings
- settings.setcpv(pkg)
- settings["EBUILD"] = self._ebuild_path
ebuild_phase = EbuildPhase(background=self.background,
pkg=pkg, phase=phase, scheduler=self.scheduler,
settings=settings, tree=self._tree)
@@ -3361,6 +3357,8 @@ class Binpkg(CompositeTask):
self.wait()
def _unlock_builddir(self):
+ if self.opts.fetchonly:
+ return
portage.elog.elog_process(self.pkg.cpv, self.settings)
self._build_dir.unlock()