Gentoo Archives: gentoo-pms

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-pms@l.g.o
Cc: "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-pms] [PATCH 11/21] Rearrange listings of phase functions
Date: Thu, 27 May 2021 20:27:53
Message-Id: 20210527202609.6445-12-ulm@gentoo.org
In Reply to: [gentoo-pms] EAPI 8 draft for review by "Ulrich Müller"
1 Signed-off-by: Ulrich Müller <ulm@g.o>
2 ---
3 eapi-differences.tex | 10 +--
4 ebuild-functions.tex | 164 ++++++++++++++++++++-----------------------
5 2 files changed, 82 insertions(+), 92 deletions(-)
6
7 diff --git a/eapi-differences.tex b/eapi-differences.tex
8 index 08c4e9f..842e09f 100644
9 --- a/eapi-differences.tex
10 +++ b/eapi-differences.tex
11 @@ -349,7 +349,7 @@ EAPI 1 is EAPI 0 with the following changes:
12 \begin{compactitem}
13 \item \t{IUSE} defaults, \featureref{iuse-defaults}.
14 \item Slot dependencies, \featureref{slot-deps}.
15 -\item Different \t{src_compile} implementation, \featureref{src-compile-1}.
16 +\item Different \t{src_compile} implementation, \featureref{src-compile}.
17 \end{compactitem}
18
19 \section{EAPI 2}
20 @@ -362,7 +362,7 @@ EAPI 2 is EAPI 1 with the following changes:
21 \item \t{!}\ and \t{!!}\ blockers, \featureref{bang-strength}.
22 \item \t{src_prepare}, \featureref{src-prepare}.
23 \item \t{src_configure}, \featureref{src-configure}.
24 -\item Different \t{src_compile} implementation, \featureref{src-compile-2}.
25 +\item Different \t{src_compile} implementation, \featureref{src-compile}.
26 \item \t{default_} phase functions for phases \t{pkg_nofetch}, \t{src_unpack}, \t{src_prepare},
27 \t{src_configure}, \t{src_compile} and \t{src_test}; \featureref{default-phase-funcs}.
28 \item \t{doman} language detection by filename, \featureref{doman-langs}.
29 @@ -391,7 +391,7 @@ EAPI 4 is EAPI 3 with the following changes:
30 \item Use dependency defaults, \featureref{use-dep-defaults}.
31 \item \t{S} to \t{WORKDIR} fallback restricted, \featureref{s-workdir-fallback}.
32 \item \t{pkg_pretend}, \featureref{pkg-pretend}.
33 -\item Default \t{src_install} no longer a no-op, \featureref{src-install-4}.
34 +\item Default \t{src_install} no longer a no-op, \featureref{src-install}.
35 \item \t{pkg_info} can run on non-installed packages, \featureref{pkg-info}.
36 \item \t{AA} is gone, \featureref{aa}.
37 \item \t{KV} is gone, \featureref{kv}.
38 @@ -436,8 +436,8 @@ EAPI 6 is EAPI 5 with the following changes:
39 \begin{compactitem}
40 \item Bash version is 4.2, \featureref{bash-version}.
41 \item \t{failglob} is enabled in global scope, \featureref{failglob}.
42 -\item Default \t{src_prepare} no longer a no-op, \featureref{src-prepare-6}.
43 -\item Different \t{src_install} implementation, \featureref{src-install-6}.
44 +\item Default \t{src_prepare} no longer a no-op, \featureref{src-prepare}.
45 +\item Different \t{src_install} implementation, \featureref{src-install}.
46 \item \t{LC_CTYPE} and \t{LC_COLLATE} compatible with POSIX locale, \featureref{locale-settings}.
47 \item \t{einstall} banned, \featureref{banned-commands}.
48 \item \t{die} and \t{assert} called with \t{-n} respect \t{nonfatal}, \featureref{nonfatal-die}.
49 diff --git a/ebuild-functions.tex b/ebuild-functions.tex
50 index 00fd259..b224e0b 100644
51 --- a/ebuild-functions.tex
52 +++ b/ebuild-functions.tex
53 @@ -120,10 +120,10 @@ The \t{src_unpack} function extracts all of the package's sources. In EAPIs lack
54 \t{src_prepare}, it may also apply patches and set up the package's build system for further use.
55
56 The initial working directory must be \t{WORKDIR}, and the default implementation used when
57 -the ebuild lacks the \t{src_unpack} function shall behave as:
58 +the ebuild lacks the \t{src_unpack} function shall behave as in listing~\ref{lst:src-unpack-0}.
59
60 \begin{listing}[H]
61 -\caption{\t{src_unpack}}
62 +\caption{\t{src_unpack}} \label{lst:src-unpack-0}
63 \begin{verbatim}
64 src_unpack() {
65 if [[ -n ${A} ]]; then
66 @@ -142,23 +142,9 @@ post-unpack source preparation.
67 The initial working directory is \t{S}, with an error or fallback to \t{WORKDIR} as discussed in
68 section~\ref{sec:s-to-workdir-fallback}.
69
70 -\featurelabel{src-prepare-6} For EAPIs listed in table~\ref{tab:src-prepare-table} as using format
71 -6, the default implementation used when the ebuild lacks the \t{src_prepare} function shall behave
72 -as:
73 -
74 -\begin{listing}[H]
75 -\caption{\t{src_prepare}, format~6}
76 -\begin{verbatim}
77 -src_prepare() {
78 - if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
79 - [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
80 - else
81 - [[ -n ${PATCHES} ]] && eapply ${PATCHES}
82 - fi
83 - eapply_user
84 -}
85 -\end{verbatim}
86 -\end{listing}
87 +For EAPIs listed in table~\ref{tab:src-prepare-table} as using format~6, the default
88 +implementation used when the ebuild lacks the \t{src_prepare} function shall behave as in
89 +listing~\ref{lst:src-prepare-6}.
90
91 For other EAPIs supporting \t{src_prepare}, the default implementation used when the ebuild lacks
92 the \t{src_prepare} function is a no-op.
93 @@ -179,6 +165,20 @@ the \t{src_prepare} function is a no-op.
94 \end{tabular}
95 \end{centertable}
96
97 +\begin{listing}[H]
98 +\caption{\t{src_prepare}, format~6} \label{lst:src-prepare-6}
99 +\begin{verbatim}
100 +src_prepare() {
101 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
102 + [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}"
103 + else
104 + [[ -n ${PATCHES} ]] && eapply ${PATCHES}
105 + fi
106 + eapply_user
107 +}
108 +\end{verbatim}
109 +\end{listing}
110 +
111 \subsection{src_configure}
112
113 \featurelabel{src-configure} The \t{src_configure} function is only called for EAPIs listed in
114 @@ -188,18 +188,8 @@ The initial working directory is \t{S}, with an error or fallback to \t{WORKDIR}
115 section~\ref{sec:s-to-workdir-fallback}.
116
117 The \t{src_configure} function configures the package's build environment. The default
118 -implementation used when the ebuild lacks the \t{src_configure} function shall behave as:
119 -
120 -\begin{listing}[H]
121 -\caption{\t{src_configure}}
122 -\begin{verbatim}
123 -src_configure() {
124 - if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
125 - econf
126 - fi
127 -}
128 -\end{verbatim}
129 -\end{listing}
130 +implementation used when the ebuild lacks the \t{src_configure} function shall behave as in
131 +listing~\ref{lst:src-configure-2}.
132
133 \ChangeWhenAddingAnEAPI{8}
134 \begin{centertable}{EAPIs supporting \t{src_configure}}
135 @@ -215,6 +205,17 @@ src_configure() {
136 \end{tabular}
137 \end{centertable}
138
139 +\begin{listing}[H]
140 +\caption{\t{src_configure}} \label{lst:src-configure-2}
141 +\begin{verbatim}
142 +src_configure() {
143 + if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
144 + econf
145 + fi
146 +}
147 +\end{verbatim}
148 +\end{listing}
149 +
150 \subsection{src_compile}
151
152 \featurelabel{src-compile} The \t{src_compile} function configures the package's build environment
153 @@ -223,12 +224,28 @@ in EAPIs lacking \t{src_configure}, and builds the package in all EAPIs.
154 The initial working directory is \t{S}, with an error or fallback to \t{WORKDIR} as discussed in
155 section~\ref{sec:s-to-workdir-fallback}.
156
157 -\featurelabel{src-compile-0} For EAPIs listed in table~\ref{tab:src-compile-table} as using format
158 -0, the default implementation used when the ebuild lacks the \t{src_compile} function shall behave
159 -as:
160 +For EAPIs listed in table~\ref{tab:src-compile-table} as using format 0, 1 or~2, the default
161 +implementation used when the ebuild lacks the \t{src_prepare} function shall behave as in
162 +listing~\ref{lst:src-compile-0}, listing~\ref{lst:src-compile-1} or listing~\ref{lst:src-compile-2},
163 +respectively.
164 +
165 +\ChangeWhenAddingAnEAPI{8}
166 +\begin{centertable}{\t{src_compile} behaviour for EAPIs}
167 + \label{tab:src-compile-table}
168 + \begin{tabular}{ll}
169 + \toprule
170 + \multicolumn{1}{c}{\textbf{EAPI}} &
171 + \multicolumn{1}{c}{\textbf{Format}} \\
172 + \midrule
173 + 0 & 0 \\
174 + 1 & 1 \\
175 + 2, 3, 4, 5, 6, 7, 8 & 2 \\
176 + \bottomrule
177 + \end{tabular}
178 +\end{centertable}
179
180 \begin{listing}[H]
181 -\caption{\t{src_compile}, format~0}
182 +\caption{\t{src_compile}, format~0} \label{lst:src-compile-0}
183 \begin{verbatim}
184 src_compile() {
185 if [[ -x ./configure ]]; then
186 @@ -241,12 +258,8 @@ src_compile() {
187 \end{verbatim}
188 \end{listing}
189
190 -\featurelabel{src-compile-1} For EAPIs listed in table~\ref{tab:src-compile-table} as using format
191 -1, the default implementation used when the ebuild lacks the \t{src_compile} function shall behave
192 -as:
193 -
194 \begin{listing}[H]
195 -\caption{\t{src_compile}, format~1}
196 +\caption{\t{src_compile}, format~1} \label{lst:src-compile-1}
197 \begin{verbatim}
198 src_compile() {
199 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
200 @@ -259,12 +272,8 @@ src_compile() {
201 \end{verbatim}
202 \end{listing}
203
204 -\featurelabel{src-compile-2} For EAPIs listed in table~\ref{tab:src-compile-table} as using format
205 -2, the default implementation used when the ebuild lacks the \t{src_compile} function shall behave
206 -as:
207 -
208 \begin{listing}[H]
209 -\caption{\t{src_compile}, format~2}
210 +\caption{\t{src_compile}, format~2} \label{lst:src-compile-2}
211 \begin{verbatim}
212 src_compile() {
213 if [[ -f Makefile ]] || [[ -f GNUmakefile ]] || [[ -f makefile ]]; then
214 @@ -274,21 +283,6 @@ src_compile() {
215 \end{verbatim}
216 \end{listing}
217
218 -\ChangeWhenAddingAnEAPI{8}
219 -\begin{centertable}{\t{src_compile} behaviour for EAPIs}
220 - \label{tab:src-compile-table}
221 - \begin{tabular}{ll}
222 - \toprule
223 - \multicolumn{1}{c}{\textbf{EAPI}} &
224 - \multicolumn{1}{c}{\textbf{Format}} \\
225 - \midrule
226 - 0 & 0 \\
227 - 1 & 1 \\
228 - 2, 3, 4, 5, 6, 7, 8 & 2 \\
229 - \bottomrule
230 - \end{tabular}
231 -\end{centertable}
232 -
233 \subsection{src_test}
234
235 The \t{src_test} function runs unit tests for the newly built but not yet installed package as
236 @@ -330,12 +324,30 @@ directory specified in \t{D}.
237 The initial working directory is \t{S}, with an error or fallback to \t{WORKDIR} as discussed in
238 section~\ref{sec:s-to-workdir-fallback}.
239
240 -\featurelabel{src-install-4} For EAPIs listed in table~\ref{tab:src-install-table} as using format
241 -4, the default implementation used when the ebuild lacks the \t{src_install} function shall behave
242 -as:
243 +For EAPIs listed in table~\ref{tab:src-install-table} as using format 4 or~6, the default
244 +implementation used when the ebuild lacks the \t{src_prepare} function shall behave as in
245 +listing~\ref{lst:src-install-4} or listing~\ref{lst:src-install-6}, respectively.
246 +
247 +For other EAPIs, the default implementation used when the ebuild lacks the \t{src_install} function
248 +is a no-op.
249 +
250 +\ChangeWhenAddingAnEAPI{8}
251 +\begin{centertable}{\t{src_install} behaviour for EAPIs}
252 + \label{tab:src-install-table}
253 + \begin{tabular}{ll}
254 + \toprule
255 + \multicolumn{1}{c}{\textbf{EAPI}} &
256 + \multicolumn{1}{c}{\textbf{Format}} \\
257 + \midrule
258 + 0, 1, 2, 3 & no-op \\
259 + 4, 5 & 4 \\
260 + 6, 7, 8 & 6 \\
261 + \bottomrule
262 + \end{tabular}
263 +\end{centertable}
264
265 \begin{listing}[H]
266 -\caption{\t{src_install}, format~4}
267 +\caption{\t{src_install}, format~4} \label{lst:src-install-4}
268 \begin{verbatim}
269 src_install() {
270 if [[ -f Makefile ]] || [[ -f GNUmakefile ]] || [[ -f makefile ]]; then
271 @@ -357,12 +369,8 @@ src_install() {
272 \end{verbatim}
273 \end{listing}
274
275 -\featurelabel{src-install-6} For EAPIs listed in table~\ref{tab:src-install-table} as using format
276 -6, the default implementation used when the ebuild lacks the \t{src_install} function shall behave
277 -as:
278 -
279 \begin{listing}[H]
280 -\caption{\t{src_install}, format~6}
281 +\caption{\t{src_install}, format~6} \label{lst:src-install-6}
282 \begin{verbatim}
283 src_install() {
284 if [[ -f Makefile ]] || [[ -f GNUmakefile ]] || [[ -f makefile ]]; then
285 @@ -373,24 +381,6 @@ src_install() {
286 \end{verbatim}
287 \end{listing}
288
289 -For other EAPIs, the default implementation used when the ebuild lacks the \t{src_install} function
290 -is a no-op.
291 -
292 -\ChangeWhenAddingAnEAPI{8}
293 -\begin{centertable}{\t{src_install} behaviour for EAPIs}
294 - \label{tab:src-install-table}
295 - \begin{tabular}{ll}
296 - \toprule
297 - \multicolumn{1}{c}{\textbf{EAPI}} &
298 - \multicolumn{1}{c}{\textbf{Format}} \\
299 - \midrule
300 - 0, 1, 2, 3 & no-op \\
301 - 4, 5 & 4 \\
302 - 6, 7, 8 & 6 \\
303 - \bottomrule
304 - \end{tabular}
305 -\end{centertable}
306 -
307 \subsection{pkg_preinst}
308
309 The \t{pkg_preinst} function performs any special tasks that are required immediately before
310 --
311 2.31.1