diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-03 07:38:55 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-03 07:38:55 +0000 |
commit | 8cc0f999b4ae9a3ead0837a52ddca36318b20ddf (patch) | |
tree | ffbd5f39a0e402c80e05725e7b5ad54f70640976 /pym/_emerge/__init__.py | |
parent | f0599bd84df768145314e741cac1420b9486d7f0 (diff) | |
download | portage-8cc0f999b4ae9a3ead0837a52ddca36318b20ddf.tar.gz portage-8cc0f999b4ae9a3ead0837a52ddca36318b20ddf.tar.bz2 portage-8cc0f999b4ae9a3ead0837a52ddca36318b20ddf.zip |
Remove the Scheduler._post_merge() method, and create a new
_show_failed_fetches() method.
svn path=/main/trunk/; revision=10906
Diffstat (limited to 'pym/_emerge/__init__.py')
-rw-r--r-- | pym/_emerge/__init__.py | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 9d9edcd01..b3e6c7a10 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -7045,6 +7045,7 @@ class Scheduler(object): self._running_tasks = set() self._max_jobs = 1 self._prefetchers = weakref.WeakValueDictionary() + self._failed_fetches = [] self._parallel_fetch = False features = self.settings.features if "parallel-fetch" in features and \ @@ -7182,6 +7183,23 @@ class Scheduler(object): prefetchers[pkg] = prefetcher self._add_task(prefetcher) + def _show_failed_fetches(self): + failed_fetches = self._failed_fetches + if not failed_fetches or not \ + ("--fetchonly" in self.myopts or \ + "--fetch-all-uri" in self.myopts): + return + + sys.stderr.write("\n\n!!! Some fetch errors were " + \ + "encountered. Please see above for details.\n\n") + + for cpv in failed_fetches: + sys.stderr.write(" ") + sys.stderr.write(cpv) + sys.stderr.write("\n") + + sys.stderr.write("\n") + def merge(self): if "--resume" in self.myopts: @@ -7220,6 +7238,9 @@ class Scheduler(object): task = running_tasks.pop() task.cancel() + self._show_failed_fetches() + del self._failed_fetches[:] + if rval == os.EX_OK or not keep_going: break if "resume" not in mtimedb: @@ -7265,6 +7286,8 @@ class Scheduler(object): del dropped_tasks self._mergelist = mylist + self._logger.log(" *** Finished. Cleaning up...") + return rval def _calc_resume_list(self): @@ -7349,7 +7372,6 @@ class Scheduler(object): favorites = self._favorites mtimedb = self._mtimedb buildpkgonly = "--buildpkgonly" in self.myopts - failed_fetches = [] fetchonly = "--fetchonly" in self.myopts or \ "--fetch-all-uri" in self.myopts oneshot = "--oneshot" in self.myopts or \ @@ -7398,16 +7420,15 @@ class Scheduler(object): pkg_count.curval += 1 try: self._execute_task(bad_resume_opts, - failed_fetches, mydbapi, pkg_count, myfeat, mymergelist, x) except self._pkg_failure, e: return e.status - return self._post_merge(mtimedb, - self._logger.xterm_titles, failed_fetches) + + return os.EX_OK def _execute_task(self, bad_resume_opts, - failed_fetches, mydbapi, pkg_count, myfeat, + mydbapi, pkg_count, myfeat, mymergelist, pkg): favorites = self._favorites mtimedb = self._mtimedb @@ -7417,6 +7438,7 @@ class Scheduler(object): buildpkgonly = "--buildpkgonly" in self.myopts fetch_all = "--fetch-all-uri" in self.myopts fetchonly = fetch_all or "--fetchonly" in self.myopts + failed_fetches = self._failed_fetches oneshot = "--oneshot" in self.myopts or \ "--onlydeps" in self.myopts @@ -7551,37 +7573,14 @@ class Scheduler(object): # Unsafe for parallel merges del mtimedb["resume"]["mergelist"][0] + if not mtimedb["resume"]["mergelist"]: + del mtimedb["resume"] # Commit after each merge so that --resume may still work in # in the event that portage is not allowed to exit normally # due to power failure, SIGKILL, etc... mtimedb.commit() self.curval += 1 - def _post_merge(self, mtimedb, xterm_titles, failed_fetches): - if "--pretend" not in self.myopts: - emergelog(xterm_titles, " *** Finished. Cleaning up...") - - # We're out of the loop... We're done. Delete the resume data. - if "resume" in mtimedb: - del mtimedb["resume"] - mtimedb.commit() - - #by doing an exit this way, --fetchonly can continue to try to - #fetch everything even if a particular download fails. - if "--fetchonly" in self.myopts or "--fetch-all-uri" in self.myopts: - if failed_fetches: - sys.stderr.write("\n\n!!! Some fetch errors were " + \ - "encountered. Please see above for details.\n\n") - for cpv in failed_fetches: - sys.stderr.write(" ") - sys.stderr.write(cpv) - sys.stderr.write("\n") - sys.stderr.write("\n") - sys.exit(1) - else: - sys.exit(0) - return os.EX_OK - class UninstallFailure(portage.exception.PortageException): """ An instance of this class is raised by unmerge() when |