Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/, pym/_emerge/
Date: Sat, 29 Sep 2012 02:36:43
Message-Id: 1348886177.2377357f4e0164d338c1249c79f479229aa7c0e4.zmedico@gentoo
1 commit: 2377357f4e0164d338c1249c79f479229aa7c0e4
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 29 02:36:17 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 29 02:36:17 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2377357f
7
8 Handle KeyError when loading pickles.
9
10 See http://forums.gentoo.org/viewtopic-t-938022.html for example.
11
12 ---
13 pym/_emerge/BlockerCache.py | 4 +++-
14 pym/portage/dbapi/vartree.py | 4 +++-
15 pym/portage/getbinpkg.py | 4 +++-
16 3 files changed, 9 insertions(+), 3 deletions(-)
17
18 diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py
19 index fce81f8..9195524 100644
20 --- a/pym/_emerge/BlockerCache.py
21 +++ b/pym/_emerge/BlockerCache.py
22 @@ -62,7 +62,9 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
23 self._cache_data = mypickle.load()
24 f.close()
25 del f
26 - except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
27 + except (SystemExit, KeyboardInterrupt):
28 + raise
29 + except Exception as e:
30 if isinstance(e, EnvironmentError) and \
31 getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
32 pass
33
34 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
35 index f8980f7..5299b29 100644
36 --- a/pym/portage/dbapi/vartree.py
37 +++ b/pym/portage/dbapi/vartree.py
38 @@ -585,7 +585,9 @@ class vardbapi(dbapi):
39 aux_cache = mypickle.load()
40 f.close()
41 del f
42 - except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
43 + except (SystemExit, KeyboardInterrupt):
44 + raise
45 + except Exception as e:
46 if isinstance(e, EnvironmentError) and \
47 getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
48 pass
49
50 diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
51 index 34a5e0e..538f8c2 100644
52 --- a/pym/portage/getbinpkg.py
53 +++ b/pym/portage/getbinpkg.py
54 @@ -559,7 +559,9 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
55 out.write(_("Loaded metadata pickle.\n"))
56 out.flush()
57 metadatafile.close()
58 - except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError):
59 + except (SystemExit, KeyboardInterrupt):
60 + raise
61 + except Exception:
62 metadata = {}
63 if baseurl not in metadata:
64 metadata[baseurl]={}