From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6B2CC13877A for ; Fri, 1 Aug 2014 20:03:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EB1E1E0AB8; Fri, 1 Aug 2014 20:03:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6202AE0A95 for ; Fri, 1 Aug 2014 20:03:17 +0000 (UTC) Received: from localhost.localdomain (74.81-166-209.customer.lyse.net [81.166.209.74]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bernalex) by smtp.gentoo.org (Postfix) with ESMTPSA id F0CF23401D9 for ; Fri, 1 Aug 2014 20:03:15 +0000 (UTC) From: Alexander Berntsen To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] [PATCH] Offer to read news while calcing deps (bug 517310) Date: Fri, 1 Aug 2014 22:02:48 +0200 Message-Id: <1406923368-1285-1-git-send-email-bernalex@gentoo.org> X-Mailer: git-send-email 1.8.5.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: ddcbd837-0805-47d0-ab03-93c9a33d8be3 X-Archives-Hash: 90232749ff2b7924fac6fbe925d67750 Signed-off-by: Alexander Berntsen --- I don't have time for any more playing with this. Please test it, and ACK it if it is OK. I will merge it when I get back if it's OK. :-] pym/_emerge/actions.py | 10 ++++++++-- pym/_emerge/post_emerge.py | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index b935139..45f9167 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -4058,8 +4058,14 @@ def run_action(emerge_config): # GLEP 42 says to display news *after* an emerge --pretend if "--pretend" not in emerge_config.opts: - display_news_notification( - emerge_config.target_config, emerge_config.opts) + uq = UserQuery(emerge_config.opts) + if display_news_notification(emerge_config.target_config, + emerge_config.opts) \ + and "--ask" in emerge_config.opts \ + and uq.query("Would you like to read the news items while" \ + "calculating dependencies?", + '--ask-enter-invalid' in emerge_config.opts) == "Yes": + subprocess.call(['eselect', 'news', 'read']) retval = action_build(emerge_config.target_config.settings, emerge_config.trees, emerge_config.target_config.mtimedb, emerge_config.opts, emerge_config.action, diff --git a/pym/_emerge/post_emerge.py b/pym/_emerge/post_emerge.py index d5f1ba5..0cb533c 100644 --- a/pym/_emerge/post_emerge.py +++ b/pym/_emerge/post_emerge.py @@ -37,11 +37,14 @@ def clean_logs(settings): def display_news_notification(root_config, myopts): if "news" not in root_config.settings.features: - return + return False portdb = root_config.trees["porttree"].dbapi vardb = root_config.trees["vartree"].dbapi news_counts = count_unread_news(portdb, vardb) + if all(v == 0 for v in news_counts.values()): + return False display_news_notifications(news_counts) + return True def show_depclean_suggestion(): out = portage.output.EOutput() -- 1.8.5.5