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 25/28] EAPI 7 has automatic USE enforcing.
Date: Wed, 04 Oct 2017 20:48:05
Message-Id: 20171004204712.10391-26-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/609338
2 ---
3 dependencies.tex | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++-
4 eapi-differences.tex | 4 ++++
5 profiles.tex | 1 +
6 3 files changed, 72 insertions(+), 1 deletion(-)
7
8 diff --git a/dependencies.tex b/dependencies.tex
9 index 63d8c53..5773aef 100644
10 --- a/dependencies.tex
11 +++ b/dependencies.tex
12 @@ -384,16 +384,82 @@ It is an error for an ebuild to use a conditional use dependency when that ebuil
13 flag in \t{IUSE_EFFECTIVE}.
14
15 \subsection{USE state constraints}
16 +
17 \label{sec:required-use}
18 \t{REQUIRED_USE} contains a list of assertions that must be met by the configuration of \t{USE}
19 flags to be valid for this ebuild. In order to be matched, a \t{USE} flag in a terminal element
20 must be enabled (or disabled if it has an exclamation mark prefix).
21
22 If the package manager encounters a package version where \t{REQUIRED_USE} assertions are not met,
23 -it must treat this package version as if it was masked. No phase functions must be called.
24 +it should attempt to automatically enforce the necessary flags as detailed
25 +in section~\ref{sec:enforce-required-use}. If this feature is not supported or it fails to resolve
26 +the problem, the package manager must treat this package version as if it was masked. No phase
27 +functions must be called in that case.
28
29 It is an error for a flag to be used if it is not included in \t{IUSE_EFFECTIVE}.
30
31 +\subsubsection{Automatic enforcing of REQUIRED_USE}
32 +\label{sec:enforce-required-use}
33 +
34 +\featurelabel{auto-req-use} In EAPIs listed in table~\ref{tab:enforce-required-use-table} as
35 +supporting enforcing of \t{REQUIRED_USE}, the package manager can attempt to resolve unmet USE state
36 +constraints through automatically adjusting the effective USE flags for the package being built,
37 +according to the algorithm specified below. Any adjustments done this way must not affect
38 +the package version permanently. The package manager must reevaluate the flags using the original
39 +user configuration every time the package is being built.
40 +
41 +The package flags that are either masked or forced according to the section~\ref{sec:use-mask-force}
42 +are considered immutable. The enforcing process must not alter the values of immutable flags.
43 +If the \t{REQUIRED_USE} constraint can not be satisfied without altering immutable flags, automatic
44 +enforcing fails.
45 +
46 +In order to enforce \t{REQUIRED_USE}, the package manager should process every USE constraint,
47 +in order of listing, according to the following rules:
48 +
49 +\begin{compactitem}
50 +\item For an unmatched use flag, the package manager should negate the state of the specified flag
51 + in order to make the constraint match.
52 +\item For an unmatched all-of group, the package manager should recursively enforce all
53 + constraints inside the group, in order of listing.
54 +\item For an unmatched use-conditonal group, the package manager should recursively enforce all
55 + constraints inside the group, in order of listing. The associated condition flag is not altered.
56 +\item For an unmatched any-of group, the package manager should recursively enforce the first item
57 + inside the group that can be enforced without altering immutable flags, in order of listing.
58 +\item For an unmatched at-most-one-of group:
59 + \begin{compactitem}
60 + \item If two or more items match due to immutable flags, the package manager must report
61 + failure.
62 + \item If exactly one of the items match due to immutable flags, the package manager should
63 + enforce all other items not to match, according to the rule specified below.
64 + \item If none of the items match due to immutable flags, the package manager should enforce all
65 + items not to match but the first item in order of listing that matches currently.
66 + \end{compactitem}
67 +\item For an unmatched exactly-one-of group:
68 + \begin{compactitem}
69 + \item If none of the items match, the package manager should behave as for unmatched any-of
70 + group.
71 + \item If more than one item matches, the package manager should behave as for unmatched
72 + at-most-one-of group.
73 + \end{compactitem}
74 +\end{compactitem}
75 +
76 +In order to enforce a matched use flag item not to match, the package manager should negate
77 +the state of the flag. The method of enforcing any other item type not to match is undefined.
78 +
79 +\ChangeWhenAddingAnEAPI{7}
80 +\begin{centertable}{EAPIs supporting automatic enforcing of \t{REQUIRED_USE}}
81 + \label{tab:enforce-required-use-table}
82 + \begin{tabular}{ll}
83 + \toprule
84 + \multicolumn{1}{c}{\textbf{EAPI}} &
85 + \multicolumn{1}{c}{\textbf{Supports enforcing \t{REQUIRED_USE}?}} \\
86 + \midrule
87 + 0, 1, 2, 3, 4, 5, 6 & No \\
88 + 7 & Yes \\
89 + \bottomrule
90 + \end{tabular}
91 +\end{centertable}
92 +
93 \subsection{Restrict}
94 \label{sec:restrict}
95
96 diff --git a/eapi-differences.tex b/eapi-differences.tex
97 index a0d1f01..87ce708 100644
98 --- a/eapi-differences.tex
99 +++ b/eapi-differences.tex
100 @@ -41,6 +41,9 @@ of this document for a complete table of previous EAPIs.
101 \bottomrule
102 \endlastfoot
103
104 +\t{REQUIRED_USE} autoenforced & \compactfeatureref{auto-req-use} &
105 + No & No & No & No & Yes \\
106 +
107 \t{die} in subshell & \compactfeatureref{subshell-die} &
108 No & No & No & No & Yes \\
109
110 @@ -463,6 +466,7 @@ EAPI 7 is EAPI 6 with the following changes:
111 \item \t{nonfatal} defined both as a shell function and external command,
112 \featureref{nonfatal-fallback}.
113 \item \t{die} guaranteed to work in a subshell environment, \featureref{subshell-die}.
114 +\item automatic enforcing of \t{REQUIRED_USE} is supported, \featureref{auto-req-use}.
115 \end{compactitem}
116
117 \ChangeWhenAddingAnEAPI{7}
118 diff --git a/profiles.tex b/profiles.tex
119 index edc17af..46c7928 100644
120 --- a/profiles.tex
121 +++ b/profiles.tex
122 @@ -145,6 +145,7 @@ specification is limited to the forms defined by the directory's EAPI. In some E
123 \t{package.use} can be a directory instead of a regular file as per section~\ref{sec:line-stacking}.
124
125 \subsection{USE masking and forcing}
126 +\label{sec:use-mask-force}
127 This section covers the eight files \t{use.mask}, \t{use.force}, \t{use.stable.mask},
128 \t{use.stable.force}, \t{package.use.mask}, \t{package.use.force}, \t{package.use.stable.mask},
129 and \t{package.use.\allowbreak stable.force}. They are described together because they interact in
130 --
131 2.14.2