1 |
12d0c48ad disabled silent output for eapply, in order to obtain fuzz |
2 |
factors in build logs. However, this also causes eapply to report all |
3 |
patched files which can make logs unreadable when there are no fuzz |
4 |
factors to be reported. Instead, use verbose output only when applying |
5 |
the patch with -F0 fails. |
6 |
|
7 |
To achieve that, attempt to apply each patch with -F0 --dry-run first. |
8 |
If this succeeds, just silently apply the patch for real. If it |
9 |
doesn't, output an explicit eqawarn that the patch does not apply |
10 |
cleanly and retry with the default fuzz factor and verbose output. |
11 |
Non-silenced output applies both to successful application with fuzz |
12 |
and to failure. |
13 |
|
14 |
Signed-off-by: Michał Górny <mgorny@g.o> |
15 |
--- |
16 |
bin/phase-helpers.sh | 16 ++++++++++++++-- |
17 |
1 file changed, 14 insertions(+), 2 deletions(-) |
18 |
|
19 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
20 |
index 60f8d3243..6f9b52678 100644 |
21 |
--- a/bin/phase-helpers.sh |
22 |
+++ b/bin/phase-helpers.sh |
23 |
@@ -995,8 +995,20 @@ if ___eapi_has_eapply; then |
24 |
# -f to avoid interactivity |
25 |
# -g0 to guarantee no VCS interaction |
26 |
# --no-backup-if-mismatch not to pollute the sources |
27 |
- ${patch_cmd} -p1 -f -g0 --no-backup-if-mismatch \ |
28 |
- "${patch_options[@]}" < "${f}" |
29 |
+ local all_opts=( |
30 |
+ -p1 -f -g0 --no-backup-if-mismatch |
31 |
+ "${patch_options[@]}" |
32 |
+ ) |
33 |
+ # try applying with -F0 first, output a verbose warning |
34 |
+ # if fuzz factor is necessary |
35 |
+ if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 \ |
36 |
+ < "${f}" &>/dev/null; then |
37 |
+ all_opts+=( -s -F0 ) |
38 |
+ else |
39 |
+ eqawarn " patch failed to apply without a fuzz factor, please rebase" |
40 |
+ fi |
41 |
+ |
42 |
+ ${patch_cmd} "${all_opts[@]}" < "${f}" |
43 |
failed=${?} |
44 |
if ! eend "${failed}"; then |
45 |
__helpers_die "patch -p1 ${patch_options[*]} failed with ${f}" |
46 |
-- |
47 |
2.24.0 |