Handle potential errors in PreservedLibsRegistry.store() now that it can
authorZac Medico <zmedico@gentoo.org>
Tue, 1 Jul 2008 08:24:07 +0000 (08:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 1 Jul 2008 08:24:07 +0000 (08:24 -0000)
be called via pruneNonExisting(), due to things such as portageq calls
where the user may not have write permission to the registry.

svn path=/main/trunk/; revision=10865

pym/portage/dbapi/vartree.py

index d508d46c9d8810e65765a3e40aceb559ed70ac90..4ca0b9b1d3ce9dbe7388b2c5075406b5889161a0 100644 (file)
@@ -64,9 +64,13 @@ class PreservedLibsRegistry(object):
                """ Store the registry data to file. No need to call this if autocommit
                    was enabled.
                """
-               f = atomic_ofstream(self._filename)
-               cPickle.dump(self._data, f)
-               f.close()
+               try:
+                       f = atomic_ofstream(self._filename)
+                       cPickle.dump(self._data, f)
+                       f.close()
+               except EnvironmentError, e:
+                       if e.errno != PermissionDenied.errno:
+                               writemsg("!!! %s %s\n" % (e, self._filename), noiselevel=-1)
 
        def register(self, cpv, slot, counter, paths):
                """ Register new objects in the registry. If there is a record with the