Gentoo Archives: gentoo-pms

From: "Michał Górny" <mgorny@g.o>
To: gentoo-pms@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-pms] [PATCH 27/28] EAPI 7 supports runtime-modifiable USE flags.
Date: Wed, 04 Oct 2017 20:48:08
Message-Id: 20171004204712.10391-28-mgorny@gentoo.org
In Reply to: [gentoo-pms] [PATCHES] EAPI 7, first draft for review by "Michał Górny"
1 Bug: https://bugs.gentoo.org/424283
2 ---
3 dependencies.tex | 3 ++-
4 eapi-differences.tex | 4 ++++
5 ebuild-env-vars.tex | 5 ++++-
6 ebuild-vars.tex | 16 ++++++++++++----
7 eclasses.tex | 11 ++++++-----
8 metadata-cache.tex | 1 +
9 pkg-mgr-commands.tex | 4 ++++
10 7 files changed, 33 insertions(+), 11 deletions(-)
11
12 diff --git a/dependencies.tex b/dependencies.tex
13 index d9592d9..acc447c 100644
14 --- a/dependencies.tex
15 +++ b/dependencies.tex
16 @@ -181,7 +181,8 @@ In a use-conditional group, if the associated use flag is enabled (or disabled i
17 exclamation mark prefix), all of the child elements must be matched.
18
19 It is an error for a flag to be used if it is not included in \t{IUSE_EFFECTIVE} as described in
20 -section~\ref{sec:use-iuse-handling}.
21 +section~\ref{sec:use-iuse-handling}. Flags listed in \t{IUSE_RUNTIME} can be used only
22 +in \t{RDEPEND}, \t{PDEPEND} and \t{REQUIRED_USE}.
23
24 \subsection{Any-of dependency specifications}
25
26 diff --git a/eapi-differences.tex b/eapi-differences.tex
27 index a89f5f8..441de70 100644
28 --- a/eapi-differences.tex
29 +++ b/eapi-differences.tex
30 @@ -41,6 +41,9 @@ of this document for a complete table of previous EAPIs.
31 \bottomrule
32 \endlastfoot
33
34 +\t{IUSE_RUNTIME} & \compactfeatureref{iuse-runtime} &
35 + No & No & No & No & Yes \\
36 +
37 \t{||=} dependency group & \compactfeatureref{binding-leftmost-of} &
38 No & No & No & No & Yes \\
39
40 @@ -471,6 +474,7 @@ EAPI 7 is EAPI 6 with the following changes:
41 \item \t{die} guaranteed to work in a subshell environment, \featureref{subshell-die}.
42 \item automatic enforcing of \t{REQUIRED_USE} is supported, \featureref{auto-req-use}.
43 \item binding leftmost-of (\t{||=}) dependency group is supported, \featureref{binding-leftmost-of}.
44 +\item runtime-modifiable USE flags (\t{IUSE_RUNTIME}) are supported, \featureref{iuse-runtime}.
45 \end{compactitem}
46
47 \ChangeWhenAddingAnEAPI{7}
48 diff --git a/ebuild-env-vars.tex b/ebuild-env-vars.tex
49 index f495014..42bd3a2 100644
50 --- a/ebuild-env-vars.tex
51 +++ b/ebuild-env-vars.tex
52 @@ -355,10 +355,12 @@ table~\ref{tab:locale-settings}.
53 \subsection{USE and IUSE handling}
54 \label{sec:use-iuse-handling}
55
56 -This section discusses the handling of four variables:
57 +This section discusses the handling of five variables:
58
59 \begin{description}
60 \item[IUSE] is the variable calculated from the \t{IUSE} values defined in ebuilds and eclasses.
61 +\item[IUSE_RUNTIME] is the variable calculated from the \t{IUSE_RUNTIME} values defined in ebuilds
62 + and eclasses.
63 \item[IUSE_REFERENCEABLE] is a variable calculated from \t{IUSE} and a variety of other sources
64 described below. It is purely a conceptual variable; it is not exported to the ebuild
65 environment. Values in \t{IUSE_REFERENCEABLE} may legally be used in queries from other
66 @@ -392,6 +394,7 @@ as supporting profile defined \t{IUSE} injection, \t{IUSE_EFFECTIVE} contains th
67
68 \begin{compactitem}
69 \item All values in the calculated \t{IUSE} value.
70 +\item All values in the calculated \t{IUSE_RUNTIME} value, in EAPIs where this variable is defined.
71 \item All values in the profile \t{IUSE_IMPLICIT} variable.
72 \item All values in the profile variable named \t{USE_EXPAND_VALUES_\$\{v\}}, where \t{\$\{v\}}
73 is any value in the intersection of the profile \t{USE_EXPAND_UNPREFIXED} and
74 diff --git a/ebuild-vars.tex b/ebuild-vars.tex
75 index e4efcae..17e40ed 100644
76 --- a/ebuild-vars.tex
77 +++ b/ebuild-vars.tex
78 @@ -67,6 +67,12 @@ Ebuilds may define any of the following variables:
79 \t{IUSE} defaults, any use flag name in \t{IUSE} may be prefixed by at most one of a plus or a
80 minus sign. If such a prefix is present, the package manager may use it as a suggestion as to
81 the default value of the use flag if no other configuration overrides it.
82 +\item[IUSE_RUNTIME] \featurelabel{iuse-runtime} Additional \t{USE} flags used by the ebuild whose
83 + values can be altered in place without rebuilding from source. The flags listed
84 + in \t{IUSE_RUNTIME} must not alter the package built. They must not be referenced at build time,
85 + except for informational purposes. A single flag can not be listed in both \t{IUSE_RUNTIME}
86 + and \t{IUSE} simultaneously. Uses the same syntax as \t{IUSE}. Only in EAPIs listed
87 + in table~\ref{tab:optional-vars-table} as supporting \t{IUSE_RUNTIME}.
88 \item[REQUIRED_USE] \featurelabel{required-use} Zero or more assertions that must be met by the
89 configuration of \t{USE} flags to be valid for this ebuild. See section~\ref{sec:required-use}
90 for description and section~\ref{sec:dependencies} for full syntax. Only in EAPIs listed in
91 @@ -103,14 +109,16 @@ Ebuilds may define any of the following variables:
92 \ChangeWhenAddingAnEAPI{7}
93 \begin{centertable}{EAPIs supporting various ebuild-defined variables}
94 \label{tab:optional-vars-table}
95 - \begin{tabular}{lll}
96 + \begin{tabular}{llll}
97 \toprule
98 \multicolumn{1}{c}{\textbf{EAPI}} &
99 \multicolumn{1}{c}{\textbf{Supports \t{PROPERTIES}?}} &
100 - \multicolumn{1}{c}{\textbf{Supports \t{REQUIRED_USE}?}} \\
101 + \multicolumn{1}{c}{\textbf{Supports \t{REQUIRED_USE}?}} &
102 + \multicolumn{1}{c}{\textbf{Supports \t{IUSE_RUNTIME}?}} \\
103 \midrule
104 - 0, 1, 2, 3 & Optionally & No \\
105 - 4, 5, 6, 7 & Yes & Yes \\
106 + 0, 1, 2, 3 & Optionally & No & No \\
107 + 4, 5, 6 & Yes & Yes & No \\
108 + 7 & Yes & Yes & Yes \\
109 \bottomrule
110 \end{tabular}
111 \end{centertable}
112 diff --git a/eclasses.tex b/eclasses.tex
113 index 44683b5..9c2b685 100644
114 --- a/eclasses.tex
115 +++ b/eclasses.tex
116 @@ -34,11 +34,12 @@ The \t{inherit} command must also ensure that:
117
118 \section{Eclass-defined Metadata Keys}
119
120 -The \t{IUSE}, \t{REQUIRED_USE}, \t{DEPEND}, \t{BDEPEND}, \t{RDEPEND} and \t{PDEPEND} variables are
121 -handled specially when set by an eclass. They must be accumulated across eclasses, appending
122 -the value set by each eclass to the resulting value after the previous one is loaded. Then
123 -the eclass-defined value is appended to that defined by the ebuild. In the case of \t{RDEPEND}, this
124 -is done after the implicit \t{RDEPEND} rules in section~\ref{sec:rdepend-depend} are applied.
125 +The \t{IUSE}, \t{IUSE_RUNTIME}, \t{REQUIRED_USE}, \t{DEPEND}, \t{BDEPEND}, \t{RDEPEND}
126 +and \t{PDEPEND} variables are handled specially when set by an eclass. They must be accumulated
127 +across eclasses, appending the value set by each eclass to the resulting value after the previous
128 +one is loaded. Then the eclass-defined value is appended to that defined by the ebuild. In the case
129 +of \t{RDEPEND}, this is done after the implicit \t{RDEPEND} rules in
130 +section~\ref{sec:rdepend-depend} are applied.
131
132 \section{EXPORT_FUNCTIONS}
133
134 diff --git a/metadata-cache.tex b/metadata-cache.tex
135 index df4b8ed..3ec626e 100644
136 --- a/metadata-cache.tex
137 +++ b/metadata-cache.tex
138 @@ -37,6 +37,7 @@ order. Other lines may be present following these; their meanings are not define
139 ebuild metadata; see table~\ref{tab:defined-phases-table}.
140 \item Build-time dependencies for \t{CBUILD} host (\t{BDEPEND}).
141 Blank in some EAPIs; see table~\ref{tab:depend-table}.
142 +\item Runtime-modifiable use flags that this package respects (\t{IUSE_RUNTIME})
143 \item Blank lines to pad the file to 22 lines long
144 \end{compactenum}
145
146 diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
147 index af4cd35..eac9bc8 100644
148 --- a/pkg-mgr-commands.tex
149 +++ b/pkg-mgr-commands.tex
150 @@ -808,6 +808,10 @@ Unless otherwise noted, if any of these functions is called with a flag value th
151 in \t{IUSE_EFFECTIVE}, either behaviour is undefined or it is an error as decided by
152 table~\ref{tab:use-list-strictness}.
153
154 +In EAPIs listed in table~\ref{tab:optional-vars-table} as supporting \t{IUSE_RUNTIME}, the flags
155 +listed in \t{IUSE_RUNTIME} can only be referenced in \t{pkg_*} phases. Passing any of those flags
156 +to one of the following functions during any other phase is an error.
157 +
158 \begin{description}
159 \item[use] Returns shell true (0) if the first argument (a \t{USE} flag name) is enabled, false
160 otherwise. If the flag name is prefixed with \t{!}, returns true if the flag is disabled, and
161 --
162 2.14.2