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 12/21] EAPI 8: Default src_prepare doesn't accept options in PATCHES
Date: Thu, 27 May 2021 20:28:10
Message-Id: 20210527202609.6445-13-ulm@gentoo.org
In Reply to: [gentoo-pms] EAPI 8 draft for review by "Ulrich Müller"
1 Also simplify array detection by using the @a operator in parameter
2 expansion. This feature was introduced in bash-4.4.
3
4 Bug: https://bugs.gentoo.org/752486
5 Signed-off-by: Ulrich Müller <ulm@g.o>
6 ---
7 eapi-differences.tex | 3 ++-
8 ebuild-functions.tex | 21 ++++++++++++++++++---
9 2 files changed, 20 insertions(+), 4 deletions(-)
10
11 diff --git a/eapi-differences.tex b/eapi-differences.tex
12 index 842e09f..aeddb6e 100644
13 --- a/eapi-differences.tex
14 +++ b/eapi-differences.tex
15 @@ -124,7 +124,7 @@ Working directory in \t{pkg_*} phases & \compactfeatureref{phase-function-dir} &
16 * & Yes & Yes & Yes & Yes \\
17
18 \t{src_prepare} style & \compactfeatureref{src-prepare} &
19 - * & no-op & 6 & 6 & 6 \\
20 + * & no-op & 6 & 6 & 8 \\
21
22 \t{src_configure} & \compactfeatureref{src-configure} &
23 * & Yes & Yes & Yes & Yes \\
24 @@ -498,6 +498,7 @@ EAPI 8 is EAPI 7 with the following changes:
25 \item Selective fetch/mirror restriction, \featureref{uri-restrict}.
26 \item \t{IDEPEND}, \featureref{idepend}.
27 \item Empty working directory in \t{pkg_*} phase functions, \featureref{phase-function-dir}.
28 +\item Different \t{src_prepare} implementation, \featureref{src-prepare}.
29 \end{compactitem}
30
31 \ChangeWhenAddingAnEAPI{8}
32 diff --git a/ebuild-functions.tex b/ebuild-functions.tex
33 index b224e0b..0c745c3 100644
34 --- a/ebuild-functions.tex
35 +++ b/ebuild-functions.tex
36 @@ -142,9 +142,9 @@ post-unpack source preparation.
37 The initial working directory is \t{S}, with an error or fallback to \t{WORKDIR} as discussed in
38 section~\ref{sec:s-to-workdir-fallback}.
39
40 -For EAPIs listed in table~\ref{tab:src-prepare-table} as using format~6, the default
41 +For EAPIs listed in table~\ref{tab:src-prepare-table} as using format 6 or~8, the default
42 implementation used when the ebuild lacks the \t{src_prepare} function shall behave as in
43 -listing~\ref{lst:src-prepare-6}.
44 +listing~\ref{lst:src-prepare-6} or listing~\ref{lst:src-prepare-8}, respectively.
45
46 For other EAPIs supporting \t{src_prepare}, the default implementation used when the ebuild lacks
47 the \t{src_prepare} function is a no-op.
48 @@ -160,7 +160,8 @@ the \t{src_prepare} function is a no-op.
49 \midrule
50 0, 1 & No & Not applicable \\
51 2, 3, 4, 5 & Yes & no-op \\
52 - 6, 7, 8 & Yes & 6 \\
53 + 6, 7 & Yes & 6 \\
54 + 8 & Yes & 8 \\
55 \bottomrule
56 \end{tabular}
57 \end{centertable}
58 @@ -179,6 +180,20 @@ src_prepare() {
59 \end{verbatim}
60 \end{listing}
61
62 +\begin{listing}[H]
63 +\caption{\t{src_prepare}, format~8} \label{lst:src-prepare-8}
64 +\begin{verbatim}
65 +src_prepare() {
66 + if [[ ${PATCHES@a} == *a* ]]; then
67 + [[ -n ${PATCHES[@]} ]] && eapply -- "${PATCHES[@]}"
68 + else
69 + [[ -n ${PATCHES} ]] && eapply -- ${PATCHES}
70 + fi
71 + eapply_user
72 +}
73 +\end{verbatim}
74 +\end{listing}
75 +
76 \subsection{src_configure}
77
78 \featurelabel{src-configure} The \t{src_configure} function is only called for EAPIs listed in
79 --
80 2.31.1