diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-04-28 22:22:52 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-04-28 22:22:52 +0000 |
commit | 3e2dfe7cecbf79102895d862b439250c2ba8da43 (patch) | |
tree | 2abcf5767944e5bf77d3699cca953e1ec449769d | |
parent | fb8ac2f107a78c553e360abc3612e98550208d9f (diff) | |
download | portage-3e2dfe7cecbf79102895d862b439250c2ba8da43.tar.gz portage-3e2dfe7cecbf79102895d862b439250c2ba8da43.tar.bz2 portage-3e2dfe7cecbf79102895d862b439250c2ba8da43.zip |
Handle a potential KeyError in depgraph.display() when in --resume mode
and a package scheduled for uninstall is no longer installed.
svn path=/main/trunk/; revision=10032
-rw-r--r-- | pym/_emerge/__init__.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 616a4fb69..2ed6474ce 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -4044,16 +4044,27 @@ class depgraph(object): else: blockers.append(addl) else: - pkg = self._pkg_cache[tuple(x)] - metadata = pkg.metadata pkg_status = x[3] pkg_merge = ordered and pkg_status == "merge" if not pkg_merge and pkg_status == "merge": pkg_status = "nomerge" - ebuild_path = None - repo_name = metadata["repository"] built = pkg_type != "ebuild" installed = pkg_type == "installed" + try: + pkg = self._pkg_cache[tuple(x)] + except KeyError: + if pkg_status != "uninstall": + raise + # A package scheduled for uninstall apparently + # isn't installed anymore. Since it's already + # been uninstalled, move on to the next task. + # This case should only be reachable in --resume + # mode, since otherwise the package would have + # been cached. + continue + metadata = pkg.metadata + ebuild_path = None + repo_name = metadata["repository"] if pkg_type == "ebuild": ebuild_path = portdb.findname(pkg_key) if not ebuild_path: # shouldn't happen |