summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/repoman9
-rw-r--r--pym/portage/checksum.py15
2 files changed, 20 insertions, 4 deletions
diff --git a/bin/repoman b/bin/repoman
index 164a1278d..487cc67a4 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1095,8 +1095,13 @@ for x in scanlist:
portage._doebuild_manifest_exempt_depend -= 1
repoman_settings["O"] = checkdir
- generated_manifest = digestgen(
- mysettings=repoman_settings, myportdb=portdb)
+ try:
+ generated_manifest = digestgen(
+ mysettings=repoman_settings, myportdb=portdb)
+ except portage.exception.PermissionDenied as e:
+ generated_manifest = False
+ writemsg_level("!!! Permission denied: '%s'\n" % (e,),
+ level=logging.ERROR, noiselevel=-1)
if not generated_manifest:
print("Unable to generate manifest.")
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index f640fd9f1..eeb5995bb 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -29,8 +29,19 @@ def _generate_hash_function(hashtype, hashobject, origin="unknown"):
@type filename: String
@return: The hash and size of the data
"""
- f = open(_unicode_encode(filename,
- encoding=_encodings['fs'], errors='strict'), 'rb')
+ try:
+ f = open(_unicode_encode(filename,
+ encoding=_encodings['fs'], errors='strict'), 'rb')
+ except IOError as e:
+ func_call = "open('%s')" % filename
+ if e.errno == errno.EPERM:
+ raise portage.exception.OperationNotPermitted(func_call)
+ elif e.errno == errno.EACCES:
+ raise portage.exception.PermissionDenied(func_call)
+ elif e.errno == errno.ENOENT:
+ raise portage.exception.FileNotFound(filename)
+ else:
+ raise
blocksize = HASHING_BLOCKSIZE
data = f.read(blocksize)
size = 0