commit:     9a4dec7285edc68d7dd2166abe798e8b3b8a354d
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: Sun May 16 19:06:02 2021 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=9a4dec72

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

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, 22 insertions(+), 2 deletions(-)

diff --git a/eapi-differences.tex b/eapi-differences.tex
index 559a686..ab0ee97 100644
--- a/eapi-differences.tex
+++ b/eapi-differences.tex
@@ -121,7 +121,7 @@ Use dependencies & \compactfeatureref{use-deps} &
     * & 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 \\
@@ -536,6 +536,7 @@ EAPI 8 is EAPI 7 with the following changes:
 \item \t{dosym} can create relative paths, \featureref{dosym-relative}.
 \item \t{PROPERTIES}, \t{RESTRICT} accumulated across eclasses, 
\featureref{accumulate-vars}.
 \item \t{usev} supports an optional second argument, \featureref{usev}.
+\item Different \t{src_prepare} implementation, \featureref{src-prepare-8}.
 \end{compactitem}
 
 \ChangeWhenAddingAnEAPI{8}

diff --git a/ebuild-functions.tex b/ebuild-functions.tex
index 108b8bc..c8e02db 100644
--- a/ebuild-functions.tex
+++ b/ebuild-functions.tex
@@ -144,6 +144,24 @@ src_prepare() {
 \end{verbatim}
 \end{listing}
 
+\featurelabel{src-prepare-8} For EAPIs listed in 
table~\ref{tab:src-prepare-table} as using format
+8, the default implementation used when the ebuild lacks the \t{src_prepare} 
function shall behave
+as:
+
+\begin{listing}[H]
+\caption{\t{src_prepare}, format~8}
+\begin{verbatim}
+src_prepare() {
+    if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
+        [[ -n ${PATCHES[@]} ]] && eapply -- "${PATCHES[@]}"
+    else
+        [[ -n ${PATCHES} ]] && eapply -- ${PATCHES}
+    fi
+    eapply_user
+}
+\end{verbatim}
+\end{listing}
+
 For other EAPIs supporting \t{src_prepare}, the default implementation used 
when the ebuild lacks
 the \t{src_prepare} function is a no-op.
 
@@ -158,7 +176,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}

Reply via email to