commit:     1918cf3398adac180d9a5b0ccd7d33de7a59fca7
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun May 16 19:06:02 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu May 27 19:15:25 2021 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=1918cf33

EAPI 8: Default src_prepare doesn't accept options in PATCHES

Also simplify array detection by using the @a operator in parameter
expansion. This feature was introduced in bash-4.4.

Bug: https://bugs.gentoo.org/752486
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 eapi-differences.tex |  3 ++-
 ebuild-functions.tex | 21 ++++++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/eapi-differences.tex b/eapi-differences.tex
index 842e09f..aeddb6e 100644
--- a/eapi-differences.tex
+++ b/eapi-differences.tex
@@ -124,7 +124,7 @@ Working directory in \t{pkg_*} phases & 
\compactfeatureref{phase-function-dir} &
     * & Yes & Yes & Yes & Yes \\
 
 \t{src_prepare} style & \compactfeatureref{src-prepare} &
-    * & no-op & 6 & 6 & 6 \\
+    * & no-op & 6 & 6 & 8 \\
 
 \t{src_configure} & \compactfeatureref{src-configure} &
     * & Yes & Yes & Yes & Yes \\
@@ -498,6 +498,7 @@ EAPI 8 is EAPI 7 with the following changes:
 \item Selective fetch/mirror restriction, \featureref{uri-restrict}.
 \item \t{IDEPEND}, \featureref{idepend}.
 \item Empty working directory in \t{pkg_*} phase functions, 
\featureref{phase-function-dir}.
+\item Different \t{src_prepare} implementation, \featureref{src-prepare}.
 \end{compactitem}
 
 \ChangeWhenAddingAnEAPI{8}

diff --git a/ebuild-functions.tex b/ebuild-functions.tex
index b224e0b..0c745c3 100644
--- a/ebuild-functions.tex
+++ b/ebuild-functions.tex
@@ -142,9 +142,9 @@ post-unpack source preparation.
 The initial working directory is \t{S}, with an error or fallback to 
\t{WORKDIR} as discussed in
 section~\ref{sec:s-to-workdir-fallback}.
 
-For EAPIs listed in table~\ref{tab:src-prepare-table} as using format~6, the 
default
+For EAPIs listed in table~\ref{tab:src-prepare-table} as using format 6 or~8, 
the default
 implementation used when the ebuild lacks the \t{src_prepare} function shall 
behave as in
-listing~\ref{lst:src-prepare-6}.
+listing~\ref{lst:src-prepare-6} or listing~\ref{lst:src-prepare-8}, 
respectively.
 
 For other EAPIs supporting \t{src_prepare}, the default implementation used 
when the ebuild lacks
 the \t{src_prepare} function is a no-op.
@@ -160,7 +160,8 @@ the \t{src_prepare} function is a no-op.
       \midrule
       0, 1              & No  & Not applicable \\
       2, 3, 4, 5        & Yes & no-op          \\
-      6, 7, 8           & Yes & 6              \\
+      6, 7              & Yes & 6              \\
+      8                 & Yes & 8              \\
       \bottomrule
     \end{tabular}
 \end{centertable}
@@ -179,6 +180,20 @@ src_prepare() {
 \end{verbatim}
 \end{listing}
 
+\begin{listing}[H]
+\caption{\t{src_prepare}, format~8} \label{lst:src-prepare-8}
+\begin{verbatim}
+src_prepare() {
+    if [[ ${PATCHES@a} == *a* ]]; then
+        [[ -n ${PATCHES[@]} ]] && eapply -- "${PATCHES[@]}"
+    else
+        [[ -n ${PATCHES} ]] && eapply -- ${PATCHES}
+    fi
+    eapply_user
+}
+\end{verbatim}
+\end{listing}
+
 \subsection{src_configure}
 
 \featurelabel{src-configure} The \t{src_configure} function is only called for 
EAPIs listed in

Reply via email to