1 |
--- |
2 |
pkg-mgr-commands.tex | 32 ++++++++++++++++++++++++++++---- |
3 |
1 file changed, 28 insertions(+), 4 deletions(-) |
4 |
|
5 |
// I'm aware this isn't perfect but I tried to keep the algorithm |
6 |
// readable and reasonably concise. Hope it's good enough for a start |
7 |
// though. |
8 |
|
9 |
diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex |
10 |
index dbdbdfd..1d57d63 100644 |
11 |
--- a/pkg-mgr-commands.tex |
12 |
+++ b/pkg-mgr-commands.tex |
13 |
@@ -148,10 +148,12 @@ These commands are used during the \t{src\_prepare} phase to apply patches to th |
14 |
Ebuilds must not run any of these commands once the current phase function has returned. |
15 |
|
16 |
\begin{description} |
17 |
-\item[eapply] \featurelabel{eapply} |
18 |
- Only available in EAPIs listed in table~\ref{tab:patch-commands} as supporting \t{eapply}. |
19 |
+\item[eapply] \featurelabel{eapply} Takes zero or more patch(1) options, followed by one or more |
20 |
+ file or directory paths. Processes options and applies all patches found in specified locations |
21 |
+ according to Algorithm~\ref{alg:eapply}. Only available in EAPIs listed in |
22 |
+ table~\ref{tab:patch-commands} as supporting \t{eapply}. |
23 |
|
24 |
-\item[eapply\_user] \featurelabel{eapply-user} Takes no arguments. Package managers supporting it |
25 |
+\item[eapply\_user] \featurelabel{eapply-user} Takes no arguments. Package managers supporting i |
26 |
apply user-provided patches to the source tree in the current working directory. Exact behaviour |
27 |
is implementation defined and beyond the scope of this specification. Package managers not |
28 |
supporting it must implement the function as a no-op. Only available in EAPIs listed in |
29 |
@@ -161,7 +163,29 @@ Ebuilds must not run any of these commands once the current phase function has r |
30 |
\begin{algorithm} |
31 |
\caption{eapply logic} \label{alg:eapply} |
32 |
\begin{algorithmic}[1] |
33 |
-\STATE \COMMENT{WORK IN PROGRESS} |
34 |
+\STATE let options=() |
35 |
+\STATE let infiles=FALSE |
36 |
+\FOR{\$x in parameters} |
37 |
+ \IF{infiles is FALSE} |
38 |
+ \IF{\$x is "\t{-{}-}"} |
39 |
+ \STATE let infiles=TRUE |
40 |
+ \ELSIF{\$x starts with "\t{-}"} |
41 |
+ \STATE options+=( "\$x" ) |
42 |
+ \ELSE |
43 |
+ \STATE let infiles=TRUE |
44 |
+ \ENDIF |
45 |
+ \ENDIF |
46 |
+ |
47 |
+ \IF{infiles is TRUE} |
48 |
+ \IF{\$x is a directory} |
49 |
+ \FOR{\$f in all files matching \$x/*.diff and \$x/*.patch} |
50 |
+ \STATE call \t{patch -p1 -f -s "\$\{options[@]\}" "\$f"} |
51 |
+ \ENDFOR |
52 |
+ \ELSE |
53 |
+ \STATE call \t{patch -p1 -f -s "\$\{options[@]\}" "\$x"} |
54 |
+ \ENDIF |
55 |
+ \ENDIF |
56 |
+\ENDFOR |
57 |
\end{algorithmic} |
58 |
\end{algorithm} |
59 |
|
60 |
-- |
61 |
2.6.1 |