1 |
From: Michał Górny <mgorny@g.o> |
2 |
|
3 |
Bug: 463768 |
4 |
--- |
5 |
pkg-mgr-commands.tex | 31 +++++++++++++++++++++++++++++-- |
6 |
1 file changed, 29 insertions(+), 2 deletions(-) |
7 |
|
8 |
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex |
9 |
index 7997323..8fb8059 100644 |
10 |
--- a/pkg-mgr-commands.tex |
11 |
+++ b/pkg-mgr-commands.tex |
12 |
@@ -148,14 +148,41 @@ These commands are used during the \t{src\_prepare} phase to apply patches to th |
13 |
Ebuilds must not run any of these commands once the current phase function has returned. |
14 |
|
15 |
\begin{description} |
16 |
-\item[eapply] \featurelabel{eapply} |
17 |
+\item[eapply] \featurelabel{eapply} Takes zero or more GNU patch options, followed by one or more |
18 |
+ file or directory paths. Processes options and applies all patches found in specified locations |
19 |
+ according to Algorithm~\ref{alg:eapply}. If applying the patches fails, it aborts the build |
20 |
+ using \t{die}, unless run using \t{nonfatal}, in which case it returns non-zero exit status. |
21 |
Only available in EAPIs listed in table~\ref{tab:patch-commands} as supporting \t{eapply}. |
22 |
\end{description} |
23 |
|
24 |
\begin{algorithm} |
25 |
\caption{eapply logic} \label{alg:eapply} |
26 |
\begin{algorithmic}[1] |
27 |
-\STATE \COMMENT{WORK IN PROGRESS} |
28 |
+\IF{any parameter is equal to \t{"-{}-"}} |
29 |
+ \STATE collect all parameters before the first \t{"-{}-"} in the \t{options} array |
30 |
+ \STATE collect all parameters after the first \t{"-{}-"} in the \t{files} array |
31 |
+\ELSIF{any parameter that begins with a hyphen follows one that does not} |
32 |
+ \STATE abort the build process with an error |
33 |
+\ELSE |
34 |
+ \STATE collect all parameters beginning with a hyphen in the \t{options} array |
35 |
+ \STATE collect all remaining parameters in the \t{files} array |
36 |
+\ENDIF |
37 |
+ |
38 |
+\FORALL{\t{x} in the \t{files} array} |
39 |
+ \IF{\t{\$x} is a directory} |
40 |
+ \FORALL{files \t{f} matching \t{\$x/*.diff} or \t{\$x/*.patch}, sorted in POSIX locale} |
41 |
+ \STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$f"} |
42 |
+ \IF{child process returned with non-zero exit status} |
43 |
+ \STATE return immediately with an error |
44 |
+ \ENDIF |
45 |
+ \ENDFOR |
46 |
+ \ELSE |
47 |
+ \STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$x"} |
48 |
+ \IF{child process returned with non-zero exit status} |
49 |
+ \STATE return immediately with an error |
50 |
+ \ENDIF |
51 |
+ \ENDIF |
52 |
+\ENDFOR |
53 |
\end{algorithmic} |
54 |
\end{algorithm} |
55 |
|
56 |
-- |
57 |
2.6.1 |