1 |
>>>>> On Fri, 16 Oct 2015, Michał Górny wrote: |
2 |
|
3 |
> After updating the implementation in Portage, I noticed that we |
4 |
> probably should somehow specify here that it is an error to specify |
5 |
> directory that does not contain any *.patch/*.diff files. |
6 |
|
7 |
Updated algorithm, using input from discussion in #gentoo-qa: |
8 |
|
9 |
\IF{any parameter is equal to \t{"-{}-"}} |
10 |
\STATE collect all parameters before the first \t{"-{}-"} in the \t{options} array |
11 |
\STATE collect all parameters after the first \t{"-{}-"} in the \t{files} array |
12 |
\ELSIF{any parameter that begins with a hyphen follows one that does not} |
13 |
\STATE abort the build process with an error |
14 |
\ELSE |
15 |
\STATE collect all parameters beginning with a hyphen in the \t{options} array |
16 |
\STATE collect all remaining parameters in the \t{files} array |
17 |
\ENDIF |
18 |
\IF{the \t{files} array is empty} |
19 |
\STATE abort the build process with an error |
20 |
\ENDIF |
21 |
|
22 |
\FORALL{\t{x} in the \t{files} array} |
23 |
\IF{\t{\$x} is a directory} |
24 |
\IF{\NOT any files match \t{\$x/*.diff} or \t{\$x/*.patch}} |
25 |
\STATE abort the build process with an error |
26 |
\ENDIF |
27 |
\FORALL{files \t{f} matching \t{\$x/*.diff} or \t{\$x/*.patch}, sorted in POSIX locale} |
28 |
\STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$f"} |
29 |
\IF{child process returned with non-zero exit status} |
30 |
\STATE return immediately with that error status |
31 |
\ENDIF |
32 |
\ENDFOR |
33 |
\ELSE |
34 |
\STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$x"} |
35 |
\IF{child process returned with non-zero exit status} |
36 |
\STATE return immediately with that error status |
37 |
\ENDIF |
38 |
\ENDIF |
39 |
\ENDFOR |
40 |
|
41 |
A question that arose is if the function should unconditionally abort |
42 |
the build process if it meets an empty directory, or if it should |
43 |
respect nonfatal also in that case? |
44 |
|
45 |
Ulrich |