summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2015-10-14 18:44:02 +0200
committerUlrich Müller <ulm@gentoo.org>2015-11-08 20:29:20 +0100
commita8196cb8791b2eba41e27e9adae2c591fcefa04c (patch)
tree9766b8b5a1183ac2f484c6fc2c09fc0c14f841e2 /pkg-mgr-commands.tex
parentEAPI 6 has eapply. (diff)
downloadpms-a8196cb8791b2eba41e27e9adae2c591fcefa04c.tar.gz
pms-a8196cb8791b2eba41e27e9adae2c591fcefa04c.tar.bz2
pms-a8196cb8791b2eba41e27e9adae2c591fcefa04c.zip
EAPI 6: Explain eapply behavior.
Bug: 463768
Diffstat (limited to 'pkg-mgr-commands.tex')
-rw-r--r--pkg-mgr-commands.tex37
1 files changed, 35 insertions, 2 deletions
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
index 28a96b0..89c00ff 100644
--- a/pkg-mgr-commands.tex
+++ b/pkg-mgr-commands.tex
@@ -148,14 +148,47 @@ These commands are used during the \t{src\_prepare} phase to apply patches to th
Ebuilds must not run any of these commands once the current phase function has returned.
\begin{description}
-\item[eapply] \featurelabel{eapply}
+\item[eapply] \featurelabel{eapply} Takes zero or more GNU patch options, followed by one or more
+ file or directory paths. Processes options and applies all patches found in specified locations
+ according to Algorithm~\ref{alg:eapply}. If applying the patches fails, it aborts the build
+ using \t{die}, unless run using \t{nonfatal}, in which case it returns non-zero exit status.
Only available in EAPIs listed in table~\ref{tab:patch-commands} as supporting \t{eapply}.
\end{description}
\begin{algorithm}
\caption{eapply logic} \label{alg:eapply}
\begin{algorithmic}[1]
-\STATE \COMMENT{WORK IN PROGRESS}
+\IF{any parameter is equal to \t{"-{}-"}}
+ \STATE collect all parameters before the first \t{"-{}-"} in the \t{options} array
+ \STATE collect all parameters after the first \t{"-{}-"} in the \t{files} array
+\ELSIF{any parameter that begins with a hyphen follows one that does not}
+ \STATE abort the build process with an error
+\ELSE
+ \STATE collect all parameters beginning with a hyphen in the \t{options} array
+ \STATE collect all remaining parameters in the \t{files} array
+\ENDIF
+\IF{the \t{files} array is empty}
+ \STATE abort the build process with an error
+\ENDIF
+\FORALL{\t{x} in the \t{files} array}
+ \IF{\t{\$x} is a directory}
+ \IF{\NOT any files match \t{\$x/*.diff} or \t{\$x/*.patch}}
+ \STATE abort the build process with an error
+ \ENDIF
+ \FORALL{files \t{f} matching \t{\$x/*.diff} or \t{\$x/*.patch}, sorted in POSIX locale}
+ \STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$f"}
+ \IF{child process returned with non-zero exit status}
+ \RETURN immediately with that status
+ \ENDIF
+ \ENDFOR
+ \ELSE
+ \STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$x"}
+ \IF{child process returned with non-zero exit status}
+ \RETURN immediately with that status
+ \ENDIF
+ \ENDIF
+\ENDFOR
+\RETURN shell true (0)
\end{algorithmic}
\end{algorithm}