Gentoo Archives: gentoo-dev

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-dev@l.g.o
Cc: Thomas Deutschmann <whissi@g.o>
Subject: [gentoo-dev] [PATCH] eutils.eclass: Show death notice only when user patches were really applied
Date: Sun, 21 Aug 2016 22:16:03
Message-Id: 20160821221448.61119-1-whissi@gentoo.org
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 | 11 ++++++++++-
17 1 file changed, 10 insertions(+), 1 deletion(-)
18
19 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
20 index dbedffe..025e388 100644
21 --- a/eclass/eutils.eclass
22 +++ b/eclass/eutils.eclass
23 @@ -292,6 +292,10 @@ EPATCH_OPTS=""
24 # -E - automatically remove empty files
25 # @CODE
26 EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
27 +# @VARIABLE: EPATCH_N_APPLIED_PATCHES
28 +# @DESCRIPTION:
29 +# Counter variable which indicates how many patches were applied.
30 +EPATCH_N_APPLIED_PATCHES=0
31 # @VARIABLE: EPATCH_EXCLUDE
32 # @DESCRIPTION:
33 # List of patches not to apply. Note this is only file names,
34 @@ -595,6 +599,8 @@ epatch() {
35 : $(( count++ ))
36 done
37
38 + : $(( EPATCH_N_APPLIED_PATCHES++ ))
39 +
40 # if we had to decompress the patch, delete the temp one
41 if [[ -n ${PIPE_CMD} ]] ; then
42 rm -f "${PATCH_TARGET}"
43 @@ -1736,13 +1742,16 @@ epatch_user() {
44 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check}
45 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check}
46 if [[ -d ${EPATCH_SOURCE} ]] ; then
47 + local old_n_applied_patches=${EPATCH_N_APPLIED_PATCHES}
48 EPATCH_SOURCE=${EPATCH_SOURCE} \
49 EPATCH_SUFFIX="patch" \
50 EPATCH_FORCE="yes" \
51 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \
52 epatch
53 echo "${EPATCH_SOURCE}" > "${applied}"
54 - has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice"
55 + if [[ ${old_n_applied_patches} -lt ${EPATCH_N_APPLIED_PATCHES} ]]; then
56 + has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice"
57 + fi
58 return 0
59 fi
60 done
61 --
62 2.9.3

Replies