diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-09 23:53:10 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-09 23:53:10 +0000 |
commit | 77e7be09f6413f7ad7a1f097ed15b466923163f8 (patch) | |
tree | 72efa71115db469ec50eb048c48c8095b18cc443 | |
parent | ca8f389e7c13fe74525c2833e2f1fb83f52a1565 (diff) | |
download | portage-77e7be09f6413f7ad7a1f097ed15b466923163f8.tar.gz portage-77e7be09f6413f7ad7a1f097ed15b466923163f8.tar.bz2 portage-77e7be09f6413f7ad7a1f097ed15b466923163f8.zip |
Like in Binpkg, cancel or wait for the prefetcher in EbuildBuild.
svn path=/main/trunk/; revision=11005
-rw-r--r-- | pym/_emerge/__init__.py | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index c4d20f667..7a206fbb7 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1981,7 +1981,7 @@ class EbuildBuild(CompositeTask): __slots__ = ("args_set", "background", "find_blockers", "ldpath_mtimes", "logger", "opts", "pkg", "pkg_count", - "settings", "world_atom") + \ + "prefetcher", "settings", "world_atom") + \ ("_build_dir", "_buildpkg", "_ebuild_path", "_tree") def start(self): @@ -2001,6 +2001,37 @@ class EbuildBuild(CompositeTask): ebuild_path = portdb.findname(self.pkg.cpv) self._ebuild_path = ebuild_path + prefetcher = self.prefetcher + if prefetcher is None: + pass + elif not prefetcher.isAlive(): + prefetcher.cancel() + elif prefetcher.poll() is None: + + waiting_msg = ("Fetching '%s' " + \ + "in the background. " + \ + "To view fetch progress, run `tail -f " + \ + "/var/log/emerge-fetch.log` in another " + \ + "terminal.") % prefetcher.pkg_path + msg_prefix = colorize("GOOD", " * ") + from textwrap import wrap + waiting_msg = "".join("%s%s\n" % (msg_prefix, line) \ + for line in wrap(waiting_msg, 65)) + if not self.background: + writemsg(waiting_msg, noiselevel=-1) + + self._current_task = prefetcher + prefetcher.addExitListener(self._prefetch_exit) + return + + self._prefetch_exit(prefetcher) + + def _prefetch_exit(self, prefetcher): + + opts = self.opts + pkg = self.pkg + settings = self.settings + if opts.fetchonly and opts.pretend: fetcher = EbuildFetchPretend( fetch_all=opts.fetch_all_uri, @@ -2545,7 +2576,8 @@ class Binpkg(CompositeTask): from textwrap import wrap waiting_msg = "".join("%s%s\n" % (msg_prefix, line) \ for line in wrap(waiting_msg, 65)) - writemsg(waiting_msg, noiselevel=-1) + if not self.background: + writemsg(waiting_msg, noiselevel=-1) self._current_task = prefetcher prefetcher.addExitListener(self._prefetch_exit) @@ -2949,8 +2981,8 @@ class MergeListItem(CompositeTask): find_blockers=find_blockers, ldpath_mtimes=ldpath_mtimes, logger=logger, opts=build_opts, pkg=pkg, pkg_count=pkg_count, - settings=settings, scheduler=scheduler, - world_atom=world_atom) + prefetcher=self.prefetcher, scheduler=scheduler, + settings=settings, world_atom=world_atom) self._install_task = build self._start_task(build, self._ebuild_exit) |