aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-09-29 02:36:17 (GMT)
committerZac Medico <zmedico@gentoo.org>2012-09-29 02:36:17 (GMT)
commit2377357f4e0164d338c1249c79f479229aa7c0e4 (patch)
tree5a46d400aa9c72a0df395ea6b3c5428e567c2564
parentFix indent from last commit. (diff)
downloadportage-2377357f4e0164d338c1249c79f479229aa7c0e4.zip
portage-2377357f4e0164d338c1249c79f479229aa7c0e4.tar.gz
portage-2377357f4e0164d338c1249c79f479229aa7c0e4.tar.bz2
Handle KeyError when loading pickles.
See http://forums.gentoo.org/viewtopic-t-938022.html for example.
-rw-r--r--pym/_emerge/BlockerCache.py4
-rw-r--r--pym/portage/dbapi/vartree.py4
-rw-r--r--pym/portage/getbinpkg.py4
3 files changed, 9 insertions, 3 deletions
diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py
index fce81f8..9195524 100644
--- a/pym/_emerge/BlockerCache.py
+++ b/pym/_emerge/BlockerCache.py
@@ -62,7 +62,9 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
self._cache_data = mypickle.load()
f.close()
del f
- except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
+ except (SystemExit, KeyboardInterrupt):
+ raise
+ except Exception as e:
if isinstance(e, EnvironmentError) and \
getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
pass
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index f8980f7..5299b29 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -585,7 +585,9 @@ class vardbapi(dbapi):
aux_cache = mypickle.load()
f.close()
del f
- except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
+ except (SystemExit, KeyboardInterrupt):
+ raise
+ except Exception as e:
if isinstance(e, EnvironmentError) and \
getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
pass
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index 34a5e0e..538f8c2 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -559,7 +559,9 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
out.write(_("Loaded metadata pickle.\n"))
out.flush()
metadatafile.close()
- except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError):
+ except (SystemExit, KeyboardInterrupt):
+ raise
+ except Exception:
metadata = {}
if baseurl not in metadata:
metadata[baseurl]={}