summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-10 06:14:56 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-10 06:14:56 +0000
commitd2c2acad5199b7f5b52c5f8e0273650dc9f03dd6 (patch)
treeecac9d835b761b01f33ebd1494a3395ebfb4969f
parent312fba349f442f4e31bcbe49bbf292d2603c71cd (diff)
downloadportage-d2c2acad5199b7f5b52c5f8e0273650dc9f03dd6.tar.gz
portage-d2c2acad5199b7f5b52c5f8e0273650dc9f03dd6.tar.bz2
portage-d2c2acad5199b7f5b52c5f8e0273650dc9f03dd6.zip
Handle ValueError and UnpicklingError inside PreservedLibsRegistry.load().
svn path=/main/trunk/; revision=12822
-rw-r--r--pym/portage/dbapi/vartree.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index e3dc6a049..48a2a1639 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -62,15 +62,21 @@ class PreservedLibsRegistry(object):
def load(self):
""" Reload the registry data from file """
+ self._data = None
try:
self._data = pickle.load(open(self._filename, 'rb'))
+ except (ValueError, pickle.UnpicklingError), e:
+ writemsg_level("!!! Error loading '%s': %s\n" % \
+ (self._filename, e), level=logging.ERROR, noiselevel=-1)
except (EOFError, IOError), e:
if isinstance(e, EOFError) or e.errno == errno.ENOENT:
- self._data = {}
+ pass
elif e.errno == PermissionDenied.errno:
raise PermissionDenied(self._filename)
else:
- raise e
+ raise
+ if self._data is None:
+ self._data = {}
self._data_orig = self._data.copy()
def store(self):
""" Store the registry data to file. No need to call this if autocommit