commit:     f1d98b6dc36ff2b47c36427c9938999320352eb4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  2 04:47:11 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=f1d98b6d

news: fix value of profiles_base

This fixes matching profile paths in Display-If-Profile in news items.

bad: 
kwargs['profile']='var/db/repos/gentoo/profiles/default/linux/amd64/17.1/hardened',
 self.profile='default/linux/amd64/17.1/hardened'
good: kwargs['profile']='default/linux/amd64/17.1/hardened', 
self.profile='default/linux/amd64/17.1/hardened'

os.path.join() treats paths differently based on the components given:
'os.path.join(portdir, "profiles", os.path.sep)' passes 3 different paths,
whereas before 64d84ce2d9a333e83e2a5fba5e7ec95f936959e7, and now, we concat.
profiles and os.path.sep first so that further splitting isn't carried out.

Thanks to kurly for noticing a recent news item wasn't showing up.

Fixes: 64d84ce2d9a333e83e2a5fba5e7ec95f936959e7
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/news.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/news.py b/lib/portage/news.py
index 51d493cb7..14401814d 100644
--- a/lib/portage/news.py
+++ b/lib/portage/news.py
@@ -79,7 +79,7 @@ class NewsManager:
         portdir = portdb.repositories.mainRepoLocation()
         profiles_base = None
         if portdir is not None:
-            profiles_base = os.path.join(portdir, "profiles", os.path.sep)
+            profiles_base = os.path.join(portdir, ("profiles" + os.path.sep))
         profile_path = None
         if profiles_base is not None and portdb.settings.profile_path:
             profile_path = normalize_path(

Reply via email to