Gentoo Archives: gentoo-commits

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