Gentoo Archives: gentoo-dev

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH v3] eutils.eclass: Show death notice only when user patches were really applied
Date: Tue, 23 Aug 2016 17:26:45
Message-Id: 20160823172532.63173-2-whissi@gentoo.org
In Reply to: [gentoo-dev] [PATCH v3] eutils.eclass: Show death notice only when user patches were really applied by Thomas Deutschmann
1 As part of the user requested feature from [Gentoo-Bug #543878]
2 eutils.eclass shows a warning regarding user applied patches in case of an
3 error [Link 1].
4
5 However this warning will always be shown even if no user patch were
6 applied at all (example: empty /etc/portage/<cat>/<pkg> directory).
7
8 This commit adds a new global variable "EPATCH_N_APPLIED_PATCHES" which
9 tracks the number of applied user patches. This allows us to only show the
10 notice when user patches were really applied.
11
12 Link: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?r1=1.443&r2=1.444
13
14 Gentoo-Bug: https://bugs.gentoo.org/543878
15 ---
16 eclass/eutils.eclass | 8 +++++++-
17 1 file changed, 7 insertions(+), 1 deletion(-)
18
19 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
20 index dbedffe..aaf195b 100644
21 --- a/eclass/eutils.eclass
22 +++ b/eclass/eutils.eclass
23 @@ -595,6 +595,8 @@ epatch() {
24 : $(( count++ ))
25 done
26
27 + (( EPATCH_N_APPLIED_PATCHES++ ))
28 +
29 # if we had to decompress the patch, delete the temp one
30 if [[ -n ${PIPE_CMD} ]] ; then
31 rm -f "${PATCH_TARGET}"
32 @@ -1736,13 +1738,17 @@ epatch_user() {
33 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check}
34 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check}
35 if [[ -d ${EPATCH_SOURCE} ]] ; then
36 + local old_n_applied_patches=${EPATCH_N_APPLIED_PATCHES:-0}
37 EPATCH_SOURCE=${EPATCH_SOURCE} \
38 EPATCH_SUFFIX="patch" \
39 EPATCH_FORCE="yes" \
40 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \
41 epatch
42 echo "${EPATCH_SOURCE}" > "${applied}"
43 - has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice"
44 + if [[ ${old_n_applied_patches} -lt ${EPATCH_N_APPLIED_PATCHES} ]]; then
45 + has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || \
46 + EBUILD_DEATH_HOOKS+=" epatch_user_death_notice"
47 + fi
48 return 0
49 fi
50 done
51 --
52 2.9.3

Replies