commit: 1145130ab777fe9dc846899018b9e36a5aa073f3 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Wed Nov 5 02:09:30 2025 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Wed Nov 5 02:27:06 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1145130a
news: skip news with warning if profile is invalid Bug: https://bugs.gentoo.org/953800 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/news.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/portage/news.py b/lib/portage/news.py index b7f10e6100..0b7fd6ee75 100644 --- a/lib/portage/news.py +++ b/lib/portage/news.py @@ -1,5 +1,5 @@ # portage: news management code -# Copyright 2006-2020 Gentoo Authors +# Copyright 2006-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = [ @@ -472,6 +472,17 @@ def count_unread_news( @return: dictionary mapping repos to integer counts of unread news items """ + if not portdb.settings.profile_path: + # Skip news because the profile path is needed for items with profile restrictions. + msg = [ + _("!!! News items will not be displayed due to an invalid profile setting.") + + "\n", + _("!!! Use eselect profile to update your profile.") + "\n", + ] + for line in msg: + writemsg_level(line, level=logging.ERROR, noiselevel=-1) + return OrderedDict() + NEWS_PATH = os.path.join("metadata", "news") UNREAD_PATH = os.path.join(vardb.settings["EROOT"], NEWS_LIB_PATH, "news") news_counts = OrderedDict()
