From 7e4eba96e95a11805fe080ccaba3fe8f4470afe4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 10 Dec 2008 07:47:45 +0000 Subject: [PATCH] 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 --- pym/_emerge/__init__.py | 38 ++++++++++++++++++-------------------- 1 file 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() -- 2.26.2