From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QXhdx-0005pz-Jr for garchives@archives.gentoo.org; Fri, 17 Jun 2011 22:36:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 33E9E1C07B; Fri, 17 Jun 2011 22:35:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 06D921C07B for ; Fri, 17 Jun 2011 22:35:53 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 784701B4029 for ; Fri, 17 Jun 2011 22:35:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 8F6B08003C for ; Fri, 17 Jun 2011 22:35:52 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: bin/repoman pym/portage/checksum.py X-VCS-Directories: bin/ pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d3d1aee93c9c5f04612c9237d452e9885c10af6d Date: Fri, 17 Jun 2011 22:35:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 7d16d4f5a081566aabce3e84de4e858c commit: d3d1aee93c9c5f04612c9237d452e9885c10af6d Author: Zac Medico gentoo org> AuthorDate: Fri Jun 17 22:35:29 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Jun 17 22:35:29 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dd3d1aee9 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 -=3D 1 =20 repoman_settings["O"] =3D checkdir - generated_manifest =3D digestgen( - mysettings=3Drepoman_settings, myportdb=3Dportdb) + try: + generated_manifest =3D digestgen( + mysettings=3Drepoman_settings, myportdb=3Dportdb) + except portage.exception.PermissionDenied as e: + generated_manifest =3D False + writemsg_level("!!! Permission denied: '%s'\n" % (e,), + level=3Dlogging.ERROR, noiselevel=3D-1) =20 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, orig= in=3D"unknown"): @type filename: String @return: The hash and size of the data """ - f =3D open(_unicode_encode(filename, - encoding=3D_encodings['fs'], errors=3D'strict'), 'rb') + try: + f =3D open(_unicode_encode(filename, + encoding=3D_encodings['fs'], errors=3D'strict'), 'rb') + except IOError as e: + func_call =3D "open('%s')" % filename + if e.errno =3D=3D errno.EPERM: + raise portage.exception.OperationNotPermitted(func_call) + elif e.errno =3D=3D errno.EACCES: + raise portage.exception.PermissionDenied(func_call) + elif e.errno =3D=3D errno.ENOENT: + raise portage.exception.FileNotFound(filename) + else: + raise blocksize =3D HASHING_BLOCKSIZE data =3D f.read(blocksize) size =3D 0