commit: 0e56f99b34939bf38dcfc0f9edf43a51f6ccf3fe
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 2 04:52:54 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 2 05:25:51 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e56f99b
news: simplify isRelevant() check
Hopefully a bit easier to follow now. I'm also not convinced
it was right before, as the previous required every
restriction.checkRestriction(...)
to be true, while the original code only required *one* to be true per
restriction.
Thanks to kurly for noticing a recent news item wasn't showing up.
Fixes: 9e24d0143450628f334cdb62e579efafd1bfd2ba
Fixes: 1ffaa70544f34e93df24c0a175105a900bf272bf
Signed-off-by: Sam James <sam <AT> gentoo.org>
NEWS | 2 ++
lib/portage/news.py | 15 ++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 773df02b0..cabd52035 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Features:
* TODO
Bug fixes:
+* news: Fix matching profile paths with Display-If-Profile in some cases.
+
* checksum: Rewrite Whirlpool implementation as a C extension to substantially
improve
performance (bug #885909).
diff --git a/lib/portage/news.py b/lib/portage/news.py
index 14401814d..f81debe97 100644
--- a/lib/portage/news.py
+++ b/lib/portage/news.py
@@ -279,11 +279,16 @@ class NewsItem:
kwargs = {"vardb": vardb, "config": config, "profile": profile}
- all_match = all(
- restriction.checkRestriction(**kwargs)
- for values in self.restrictions.values()
- for restriction in values
- )
+ all_match = True
+ for values in self.restrictions.values():
+ matches = [restriction.checkRestriction(**kwargs) for restriction
in values]
+ any_match = any(matches)
+
+ # If, for a single restriction, we didn't match anything, then we
obviously
+ # didn't match everything, so just bail out.
+ if not any_match:
+ all_match = False
+ break
return all_match