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: Thu, 17 Jun 2021 17:46:15
Message-Id: 1623951900.03520f0ac680d6af62176beb4a072750c11c0b49.zmedico@gentoo
1 commit: 03520f0ac680d6af62176beb4a072750c11c0b49
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 17 17:43:49 2021 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 17 17:45:00 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=03520f0a
7
8 Revert "PORTAGE_NICENESS: Consider autogroup scheduling"
9
10 This reverts commit 055abe523c2c3f6c8f1dccfb53565209222f90c1
11 due to another regression.
12
13 See: https://github.com/gentoo/portage/pull/728
14 Bug: https://bugs.gentoo.org/777492
15 Bug: https://bugs.gentoo.org/785484
16 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
17
18 lib/_emerge/actions.py | 48 +++---------------------------------------------
19 man/make.conf.5 | 10 +---------
20 2 files changed, 4 insertions(+), 54 deletions(-)
21
22 diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
23 index df5c86c6c..1946f49df 100644
24 --- a/lib/_emerge/actions.py
25 +++ b/lib/_emerge/actions.py
26 @@ -14,7 +14,6 @@ import textwrap
27 import time
28 import warnings
29 from itertools import chain
30 -from pathlib import Path
31
32 import portage
33 portage.proxy.lazyimport.lazyimport(globals(),
34 @@ -2635,55 +2634,14 @@ def apply_priorities(settings):
35 nice(settings)
36
37 def nice(settings):
38 - nice_value: str = settings.get("PORTAGE_NICENESS", "").strip()
39 - if not nice_value:
40 - return
41 -
42 try:
43 - current_nice_value = os.nice(int(nice_value))
44 - # Calling os.nice() with a value outside of the valid range of
45 - # nice values, e.g. 20, caps the process's nice value. This is
46 - # because the argument of os.nice() is not an absolute value,
47 - # but the increment to the process's current nice
48 - # value. Hence users may use PORTAGE_NICENESS=20 without any
49 - # issues here. However, below we write nice_value potentially
50 - # to /proc/self/autogroup, which will only accept valid nice
51 - # values. Therefore we simply set nice_value to what os.nice()
52 - # returned (i.e. the process's current nice value).
53 - nice_value = str(current_nice_value)
54 + os.nice(int(settings.get("PORTAGE_NICENESS", "0")))
55 except (OSError, ValueError) as e:
56 out = portage.output.EOutput()
57 - out.eerror(f"Failed to change nice value to {nice_value}")
58 + out.eerror("Failed to change nice value to '%s'" % \
59 + settings.get("PORTAGE_NICENESS", "0"))
60 out.eerror("%s\n" % str(e))
61
62 - autogroup_file = Path("/proc/self/autogroup")
63 - try:
64 - f = autogroup_file.open("r+")
65 - except EnvironmentError:
66 - # Autogroup scheduling is not enabled on this system.
67 - return
68 -
69 - with f:
70 - line = f.readline()
71 - original_autogroup_nice_value = line.split(" ")[2]
72 -
73 - # We need to restore the original nice value of the
74 - # autogroup, as otherwise the session, e.g. the
75 - # terminal where portage was executed in, would
76 - # continue running with that value.
77 - portage.atexit_register(
78 - lambda value: autogroup_file.write_text(value),
79 - original_autogroup_nice_value,
80 - )
81 -
82 - try:
83 - f.write(nice_value)
84 - except EnvironmentError as e:
85 - out = portage.output.EOutput()
86 - out.eerror(f"Failed to change autogroup's nice value to {nice_value}")
87 - out.eerror("%s\n" % str(e))
88 -
89 -
90 def ionice(settings):
91
92 ionice_cmd = settings.get("PORTAGE_IONICE_COMMAND")
93
94 diff --git a/man/make.conf.5 b/man/make.conf.5
95 index 18573b5e2..1c72109ad 100644
96 --- a/man/make.conf.5
97 +++ b/man/make.conf.5
98 @@ -1,4 +1,4 @@
99 -.TH "MAKE.CONF" "5" "Jun 2021" "Portage VERSION" "Portage"
100 +.TH "MAKE.CONF" "5" "May 2021" "Portage VERSION" "Portage"
101 .SH "NAME"
102 make.conf \- custom settings for Portage
103 .SH "SYNOPSIS"
104 @@ -1031,14 +1031,6 @@ The value of this variable will be added to the current nice level that
105 emerge is running at. In other words, this will not set the nice level,
106 it will increment it. For more information about nice levels and what
107 are acceptable ranges, see \fBnice\fR(1).
108 -.br
109 -If set and portage is run under Linux with autogroup scheduling (see
110 -\fBsched\fR(7)) enabled, then portage will set the nice value of its
111 -autogroup to PORTAGE_NICENESS. Upon exiting, portage will restore the
112 -original value. Note that if the function responsible for restoring the
113 -original value is not run, e.g., because portage's process was killed,
114 -then the autogroup will stay niced. In such a case, the value can be
115 -reset via corresponding autogroup pseudo\-file in /proc.
116 .TP
117 \fBPORTAGE_RO_DISTDIRS\fR = \fI[space delimited list of directories]\fR
118 When a given file does not exist in \fBDISTDIR\fR, search for the file