public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/
Date: Fri, 17 Jun 2011 22:35:52 +0000 (UTC)	[thread overview]
Message-ID: <d3d1aee93c9c5f04612c9237d452e9885c10af6d.zmedico@gentoo> (raw)

commit:     d3d1aee93c9c5f04612c9237d452e9885c10af6d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 17 22:35:29 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jun 17 22:35:29 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d3d1aee9

repoman: handle PermissionDenied from digestgen

This will fix bug #371987.

---
 bin/repoman             |    9 +++++++--
 pym/portage/checksum.py |   15 +++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 164a127..487cc67 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 f640fd9..eeb5995 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



             reply	other threads:[~2011-06-17 22:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 22:35 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-17 17:43 [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/ Zac Medico
2013-11-29 23:24 Mike Frysinger
2013-06-25  7:48 Zac Medico
2013-06-23 22:57 Zac Medico
2013-06-23 22:40 Zac Medico
2013-02-11  9:39 Zac Medico
2013-01-19  5:16 Zac Medico
2013-01-19  5:00 Zac Medico
2013-01-19  3:23 Zac Medico
2013-01-19  3:23 Zac Medico
2013-01-19  2:27 Zac Medico
2013-01-19  1:53 Zac Medico
2012-10-18  0:05 Zac Medico
2012-03-17 16:44 Zac Medico
2012-03-11  1:40 Mike Frysinger
2011-12-08  7:26 Zac Medico
2011-06-04  1:39 Zac Medico
2011-02-20  0:00 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3d1aee93c9c5f04612c9237d452e9885c10af6d.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox