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 1R0NXH-0001B2-4T for garchives@archives.gentoo.org; Mon, 05 Sep 2011 00:59:39 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 83CDB21C03C; Mon, 5 Sep 2011 00:59:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4F58421C03C for ; Mon, 5 Sep 2011 00:59:30 +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 D8B5C1B400F for ; Mon, 5 Sep 2011 00:59:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B3C3380042 for ; Mon, 5 Sep 2011 00:59:25 +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: <8539b5778f1cea24aab4ff47b1b65516c254de1f.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/actions.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 8539b5778f1cea24aab4ff47b1b65516c254de1f Date: Mon, 5 Sep 2011 00:59:25 +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: 0e1aadd6c91153b02e973cc706d29491 commit: 8539b5778f1cea24aab4ff47b1b65516c254de1f Author: Zac Medico gentoo org> AuthorDate: Mon Sep 5 00:58:44 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Sep 5 00:58:44 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D8539b577 Update unread news items in --pretend mode. This has been disabled since commit c7faa634369e61b87a40172ceb0a5cb9494fd518, but the only reason cited was to avoid permissions issues. So, go ahead and enable it, and handle PermissionDenied just in case. NOTE: The NewsManager typically handles permission errors by returning silently, so PermissionDenied won't necessarily be raised even if we do trigger a permission error. --- pym/_emerge/actions.py | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 3477c19..82adca7 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -30,7 +30,7 @@ from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE= _SET_CONFIG from portage.dbapi.dep_expand import dep_expand from portage.dbapi._expand_new_virt import expand_new_virt from portage.dep import Atom, extended_cp_match -from portage.exception import InvalidAtom +from portage.exception import InvalidAtom, PermissionDenied from portage.output import blue, bold, colorize, create_color_func, dark= green, \ red, yellow good =3D create_color_func("GOOD") @@ -3049,13 +3049,26 @@ def display_news_notification(root_config, myopts= ): NEWS_PATH =3D os.path.join("metadata", "news") UNREAD_PATH =3D os.path.join(target_root, NEWS_LIB_PATH, "news") newsReaderDisplay =3D False - update =3D "--pretend" not in myopts if "news" not in settings.features: return =20 + permission_msgs =3D set() for repo in portdb.getRepositories(): - unreadItems =3D checkUpdatedNewsItems( - portdb, vardb, NEWS_PATH, UNREAD_PATH, repo, update=3Dupdate) + try: + unreadItems =3D checkUpdatedNewsItems( + portdb, vardb, NEWS_PATH, UNREAD_PATH, repo, update=3DTrue) + except PermissionDenied as e: + # NOTE: The NewsManager typically handles permission errors by + # returning silently, so PermissionDenied won't necessarily be + # raised even if we do trigger a permission error above. + msg =3D _unicode_decode("Permission denied: '%s'\n") % (e,) + if msg in permission_msgs: + pass + else: + permission_msgs.add(msg) + writemsg_level(msg, level=3Dlogging.ERROR, noiselevel=3D-1) + unreadItems =3D None + if unreadItems: if not newsReaderDisplay: newsReaderDisplay =3D True