Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] eapply: Output verbosely only if patch fails to apply with -F0
Date: Wed, 27 Nov 2019 19:13:43
Message-Id: 78f81c7e-4800-935f-301a-2d85be7f4c03@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] eapply: Output verbosely only if patch fails to apply with -F0 by "Michał Górny"
1 On 11/27/19 10:54 AM, Michał Górny wrote:
2 > 12d0c48ad disabled silent output for eapply, in order to obtain fuzz
3 > factors in build logs. However, this also causes eapply to report all
4 > patched files which can make logs unreadable when there are no fuzz
5 > factors to be reported. Instead, use verbose output only when applying
6 > the patch with -F0 fails.
7 >
8 > To achieve that, attempt to apply each patch with -F0 --dry-run first.
9 > If this succeeds, just silently apply the patch for real. If it
10 > doesn't, output an explicit eqawarn that the patch does not apply
11 > cleanly and retry with the default fuzz factor and verbose output.
12 > Non-silenced output applies both to successful application with fuzz
13 > and to failure.
14 >
15 > Signed-off-by: Michał Górny <mgorny@g.o>
16 > ---
17 > bin/phase-helpers.sh | 16 ++++++++++++++--
18 > 1 file changed, 14 insertions(+), 2 deletions(-)
19 >
20 > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
21 > index 60f8d3243..6f9b52678 100644
22 > --- a/bin/phase-helpers.sh
23 > +++ b/bin/phase-helpers.sh
24 > @@ -995,8 +995,20 @@ if ___eapi_has_eapply; then
25 > # -f to avoid interactivity
26 > # -g0 to guarantee no VCS interaction
27 > # --no-backup-if-mismatch not to pollute the sources
28 > - ${patch_cmd} -p1 -f -g0 --no-backup-if-mismatch \
29 > - "${patch_options[@]}" < "${f}"
30 > + local all_opts=(
31 > + -p1 -f -g0 --no-backup-if-mismatch
32 > + "${patch_options[@]}"
33 > + )
34 > + # try applying with -F0 first, output a verbose warning
35 > + # if fuzz factor is necessary
36 > + if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 \
37 > + < "${f}" &>/dev/null; then
38 > + all_opts+=( -s -F0 )
39 > + else
40 > + eqawarn " patch failed to apply without a fuzz factor, please rebase"
41
42 The earlier ebegin call only outputs the basename, so there could be
43 some confusion about the origin of the patch. This function is also
44 called by eapply_user, it's possible that people could get confused and
45 report bugs about fuzz in their local patches. Other than that it looks
46 good.
47
48 > + fi
49 > +
50 > + ${patch_cmd} "${all_opts[@]}" < "${f}"
51 > failed=${?}
52 > if ! eend "${failed}"; then
53 > __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}"
54 >
55 --
56 Thanks,
57 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies