perform_checksum: OSerror to PermissionDenied
authorZac Medico <zmedico@gentoo.org>
Mon, 17 Oct 2011 03:03:25 +0000 (20:03 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 17 Oct 2011 03:03:25 +0000 (20:03 -0700)
pym/portage/checksum.py

index 9f3d81cff8010e5560cb0eb982e8e5af511c0d87..e0bff2ada1ea8e0a882a5292466d54c391984299 100644 (file)
@@ -284,8 +284,10 @@ def perform_checksum(filename, hashname="MD5", calc_prelink=0):
                                        " hash function not available (needs dev-python/pycrypto)")
                        myhash, mysize = hashfunc_map[hashname](myfilename)
                except (OSError, IOError) as e:
-                       if e.errno == errno.ENOENT:
+                       if e.errno in (errno.ENOENT, errno.ESTALE):
                                raise portage.exception.FileNotFound(myfilename)
+                       elif e.errno == portage.exception.PermissionDenied.errno:
+                               raise portage.exception.PermissionDenied(myfilename)
                        raise
                return myhash, mysize
        finally: