Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/
Date: Thu, 28 Oct 2021 04:07:43
Message-Id: 1635394053.0e9e12aadb889766d61c0561b9723e71542d43e6.sam@gentoo
1 commit: 0e9e12aadb889766d61c0561b9723e71542d43e6
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 7 03:15:09 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 28 04:07:33 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e9e12aa
7
8 lib/_emerge/actions.py: warn on missing /run
9
10 Newer versions of build-docbook-catalog use
11 /run/lock. This exposed that we weren't
12 asking users to mount /run in the handbook.
13
14 Check if it exists and warn if it doesn't.
15
16 This should primarily (exclusively?) be a
17 problem in chroots given an init system
18 should be creating this.
19
20 Bug: https://bugs.gentoo.org/816303
21 Closes: https://github.com/gentoo/portage/pull/762
22 Reviewed-by: Alec Warner <antarus <AT> gentoo.org>
23 Reviewed-by: Mike Gilbert <floppym <AT> gentoo.org>
24 Thanks-to: Duncan
25 Signed-off-by: Sam James <sam <AT> gentoo.org>
26
27 lib/_emerge/actions.py | 33 +++++++++++++++++++++------------
28 1 file changed, 21 insertions(+), 12 deletions(-)
29
30 diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
31 index 05a115250..515b22b66 100644
32 --- a/lib/_emerge/actions.py
33 +++ b/lib/_emerge/actions.py
34 @@ -2986,17 +2986,25 @@ def validate_ebuild_environment(trees):
35 check_locale()
36
37
38 -def check_procfs():
39 - procfs_path = "/proc"
40 - if platform.system() not in ("Linux",) or os.path.ismount(procfs_path):
41 - return os.EX_OK
42 - msg = "It seems that %s is not mounted. You have been warned." % procfs_path
43 - writemsg_level(
44 - "".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
45 - level=logging.ERROR,
46 - noiselevel=-1,
47 - )
48 - return 1
49 +def check_mounted_fs():
50 + """We need /proc for finding CPU counts and finding other system information.
51 + We need /run for e.g. lock files in ebuilds."""
52 + paths = {"/proc": False, "/run": False}
53 +
54 + for path in paths.keys():
55 + if platform.system() not in ("Linux",) or os.path.ismount(path):
56 + paths[path] = True
57 + continue
58 +
59 + msg = "It seems %s is not mounted. Process management may malfunction." % path
60 + writemsg_level(
61 + "".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
62 + level=logging.ERROR,
63 + noiselevel=-1,
64 + )
65 +
66 + # Were all of the mounts we were looking for available?
67 + return all(paths.values())
68
69
70 def config_protect_check(trees):
71 @@ -3474,7 +3482,8 @@ def run_action(emerge_config):
72 repo_name_check(emerge_config.trees)
73 repo_name_duplicate_check(emerge_config.trees)
74 config_protect_check(emerge_config.trees)
75 - check_procfs()
76 +
77 + check_mounted_fs()
78
79 for mytrees in emerge_config.trees.values():
80 mydb = mytrees["porttree"].dbapi