commit:     0e9e12aadb889766d61c0561b9723e71542d43e6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  7 03:15:09 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 28 04:07:33 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e9e12aa

lib/_emerge/actions.py: warn on missing /run

Newer versions of build-docbook-catalog use
/run/lock. This exposed that we weren't
asking users to mount /run in the handbook.

Check if it exists and warn if it doesn't.

This should primarily (exclusively?) be a
problem in chroots given an init system
should be creating this.

Bug: https://bugs.gentoo.org/816303
Closes: https://github.com/gentoo/portage/pull/762
Reviewed-by: Alec Warner <antarus <AT> gentoo.org>
Reviewed-by: Mike Gilbert <floppym <AT> gentoo.org>
Thanks-to: Duncan
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/actions.py | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index 05a115250..515b22b66 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -2986,17 +2986,25 @@ def validate_ebuild_environment(trees):
     check_locale()
 
 
-def check_procfs():
-    procfs_path = "/proc"
-    if platform.system() not in ("Linux",) or os.path.ismount(procfs_path):
-        return os.EX_OK
-    msg = "It seems that %s is not mounted. You have been warned." % 
procfs_path
-    writemsg_level(
-        "".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
-        level=logging.ERROR,
-        noiselevel=-1,
-    )
-    return 1
+def check_mounted_fs():
+    """We need /proc for finding CPU counts and finding other system 
information.
+    We need /run for e.g. lock files in ebuilds."""
+    paths = {"/proc": False, "/run": False}
+
+    for path in paths.keys():
+        if platform.system() not in ("Linux",) or os.path.ismount(path):
+            paths[path] = True
+            continue
+
+        msg = "It seems %s is not mounted. Process management may 
malfunction." % path
+        writemsg_level(
+            "".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
+            level=logging.ERROR,
+            noiselevel=-1,
+        )
+
+    # Were all of the mounts we were looking for available?
+    return all(paths.values())
 
 
 def config_protect_check(trees):
@@ -3474,7 +3482,8 @@ def run_action(emerge_config):
         repo_name_check(emerge_config.trees)
         repo_name_duplicate_check(emerge_config.trees)
         config_protect_check(emerge_config.trees)
-    check_procfs()
+
+    check_mounted_fs()
 
     for mytrees in emerge_config.trees.values():
         mydb = mytrees["porttree"].dbapi

Reply via email to