commit:     97f1f6a42796c91bf1eba628605c4ef641dcc532
Author:     James Stevenson <james.al.stevenson <AT> gmail <DOT> com>
AuthorDate: Sat Sep  4 09:53:46 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Sep  4 11:51:28 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=97f1f6a4

Warn if portage home directory is missing

Signed-off-by: James Stevenson <james.al.stevenson <AT> gmail.com>
Bug: https://bugs.gentoo.org/674212
Closes: https://github.com/gentoo/portage/pull/736
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 lib/portage/data.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/portage/data.py b/lib/portage/data.py
index 3887ad32e..21f350934 100644
--- a/lib/portage/data.py
+++ b/lib/portage/data.py
@@ -178,6 +178,15 @@ def _get_global(k):
                                noiselevel=-1)
                        portage_group_warning()
 
+               portage_homedir_ready = 
os.access(os.path.expanduser("~portage"),
+                       os.R_OK | os.W_OK | os.X_OK)
+               if not portage_homedir_ready:
+                       writemsg(
+                               colorize("BAD",
+                               _("portage: unable to utilise 'portage' user 
home directory."
+                                       + " Ensure that it exists with the 
correct permissions."))
+                               + "\n", noiselevel=-1)
+
                globals()['portage_gid'] = portage_gid
                _initialized_globals.add('portage_gid')
                globals()['portage_uid'] = portage_uid

Reply via email to