Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: man/, lib/_emerge/
Date: Mon, 14 Jun 2021 06:28:36
Message-Id: 1623651960.ac4f07b4b04aadf57f78cb21729e1f5439609f81.zmedico@gentoo
1 commit: ac4f07b4b04aadf57f78cb21729e1f5439609f81
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 14 06:23:56 2021 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 14 06:26:00 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ac4f07b4
7
8 Revert "PORTAGE_NICENESS: Consider autogroup scheduling"
9
10 This reverts commit a4d882964ee1931462f911d0c46a80e27e59fa48.
11 It triggered this regression:
12
13 # PORTAGE_NICENESS=20 emerge -av --depclean
14 OSError: [Errno 22] Invalid argument
15
16 During handling of the above exception, another exception occurred:
17
18 Traceback (most recent call last):
19 File "/usr/lib/python-exec/python3.9/emerge", line 51, in <module>
20 retval = emerge_main()
21 File "/usr/lib/python3.9/site-packages/_emerge/main.py", line 1319, in emerge_main
22 return run_action(emerge_config)
23 File "/usr/lib/python3.9/site-packages/_emerge/actions.py", line 2999, in run_action
24 apply_priorities(emerge_config.target_config.settings)
25 File "/usr/lib/python3.9/site-packages/_emerge/actions.py", line 2635, in apply_priorities
26 nice(settings)
27 File "/usr/lib/python3.9/site-packages/_emerge/actions.py", line 2672, in nice
28 out.eerror("%s\n" % str(e))
29 OSError: [Errno 22] Invalid argument
30
31 Bug: https://bugs.gentoo.org/777492#c4
32 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
33
34 lib/_emerge/actions.py | 36 +++---------------------------------
35 man/make.conf.5 | 10 +---------
36 2 files changed, 4 insertions(+), 42 deletions(-)
37
38 diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
39 index bfb08ed6b..1946f49df 100644
40 --- a/lib/_emerge/actions.py
41 +++ b/lib/_emerge/actions.py
42 @@ -14,7 +14,6 @@ import textwrap
43 import time
44 import warnings
45 from itertools import chain
46 -from pathlib import Path
47
48 import portage
49 portage.proxy.lazyimport.lazyimport(globals(),
50 @@ -2635,43 +2634,14 @@ def apply_priorities(settings):
51 nice(settings)
52
53 def nice(settings):
54 - nice_value: str = settings.get("PORTAGE_NICENESS", "0")
55 -
56 try:
57 - os.nice(int(nice_value))
58 + os.nice(int(settings.get("PORTAGE_NICENESS", "0")))
59 except (OSError, ValueError) as e:
60 out = portage.output.EOutput()
61 - out.eerror(f"Failed to change nice value to {nice_value}")
62 + out.eerror("Failed to change nice value to '%s'" % \
63 + settings.get("PORTAGE_NICENESS", "0"))
64 out.eerror("%s\n" % str(e))
65
66 - autogroup_file = Path("/proc/self/autogroup")
67 - try:
68 - f = autogroup_file.open("r+")
69 - except EnvironmentError:
70 - # Autogroup scheduling is not enabled on this system.
71 - return
72 -
73 - with f:
74 - line = f.readline()
75 - original_autogroup_nice_value = line.split(" ")[2]
76 -
77 - # We need to restore the original nice value of the
78 - # autogroup, as otherwise the session, e.g. the
79 - # terminal where portage was executed in, would
80 - # continue running with that value.
81 - portage.atexit_register(
82 - lambda value: autogroup_file.write_text(value),
83 - original_autogroup_nice_value,
84 - )
85 -
86 - try:
87 - f.write(nice_value)
88 - except EnvironmentError as e:
89 - out = portage.output.EOutput()
90 - out.eerror(f"Failed to change autogroup's nice value to {nice_value}")
91 - out.eerror("%s\n" % str(e))
92 -
93 -
94 def ionice(settings):
95
96 ionice_cmd = settings.get("PORTAGE_IONICE_COMMAND")
97
98 diff --git a/man/make.conf.5 b/man/make.conf.5
99 index 18573b5e2..1c72109ad 100644
100 --- a/man/make.conf.5
101 +++ b/man/make.conf.5
102 @@ -1,4 +1,4 @@
103 -.TH "MAKE.CONF" "5" "Jun 2021" "Portage VERSION" "Portage"
104 +.TH "MAKE.CONF" "5" "May 2021" "Portage VERSION" "Portage"
105 .SH "NAME"
106 make.conf \- custom settings for Portage
107 .SH "SYNOPSIS"
108 @@ -1031,14 +1031,6 @@ The value of this variable will be added to the current nice level that
109 emerge is running at. In other words, this will not set the nice level,
110 it will increment it. For more information about nice levels and what
111 are acceptable ranges, see \fBnice\fR(1).
112 -.br
113 -If set and portage is run under Linux with autogroup scheduling (see
114 -\fBsched\fR(7)) enabled, then portage will set the nice value of its
115 -autogroup to PORTAGE_NICENESS. Upon exiting, portage will restore the
116 -original value. Note that if the function responsible for restoring the
117 -original value is not run, e.g., because portage's process was killed,
118 -then the autogroup will stay niced. In such a case, the value can be
119 -reset via corresponding autogroup pseudo\-file in /proc.
120 .TP
121 \fBPORTAGE_RO_DISTDIRS\fR = \fI[space delimited list of directories]\fR
122 When a given file does not exist in \fBDISTDIR\fR, search for the file