Skip to content

Commit

Permalink
news: fix value of profiles_base
Browse files Browse the repository at this point in the history
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 64d84ce, 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: 64d84ce
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
thesamesam committed Jan 2, 2023
1 parent 9fd0f84 commit f1d98b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/portage/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, portdb, vardb, news_path, unread_path, language_id="en"):
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(
Expand Down

0 comments on commit f1d98b6

Please sign in to comment.