1 |
--- |
2 |
pkg-mgr-commands.tex | 33 ++++++++++++++++++++++++++++++--- |
3 |
1 file changed, 30 insertions(+), 3 deletions(-) |
4 |
|
5 |
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex |
6 |
index dbdbdfd..324295f 100644 |
7 |
--- a/pkg-mgr-commands.tex |
8 |
+++ b/pkg-mgr-commands.tex |
9 |
@@ -148,8 +148,11 @@ These commands are used during the \t{src\_prepare} phase to apply patches to th |
10 |
Ebuilds must not run any of these commands once the current phase function has returned. |
11 |
|
12 |
\begin{description} |
13 |
-\item[eapply] \featurelabel{eapply} |
14 |
- Only available in EAPIs listed in table~\ref{tab:patch-commands} as supporting \t{eapply}. |
15 |
+\item[eapply] \featurelabel{eapply} Takes zero or more GNU patch options, followed by one or more |
16 |
+ file or directory paths. Processes options and applies all patches found in specified locations |
17 |
+ according to Algorithm~\ref{alg:eapply}. If it fails, it aborts the build using \t{die}, |
18 |
+ unless run using \t{nonfatal}, in which case it returns non-zero exit status. Only available |
19 |
+ in EAPIs listed in table~\ref{tab:patch-commands} as supporting \t{eapply}. |
20 |
|
21 |
\item[eapply\_user] \featurelabel{eapply-user} Takes no arguments. Package managers supporting it |
22 |
apply user-provided patches to the source tree in the current working directory. Exact behaviour |
23 |
@@ -161,7 +164,31 @@ Ebuilds must not run any of these commands once the current phase function has r |
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 options array |
30 |
+ \STATE collect all parameters after the first \t{"-{}-"} in the files array |
31 |
+\ELSIF{any parameter beginning with a hyphen follows one that does not begin with a hyphen} |
32 |
+ \STATE abort the build process with an error |
33 |
+\ELSE |
34 |
+ \STATE collect all parameters beginning with a hyphen in the options array |
35 |
+ \STATE collect all remaining parameters in the files array |
36 |
+\ENDIF |
37 |
+ |
38 |
+\FOR{\$x in files} |
39 |
+ \IF{\$x is a directory} |
40 |
+ \FOR{\$f in all files matching \$x/*.diff and \$x/*.patch} |
41 |
+ \STATE call \t{patch -p1 -f -g0 --no-backup-if-mismatch "\$\{options[@]\}" "\$f"} |
42 |
+ \IF{spawned patch process returns 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{spawned patch process returns 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 |