From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C306113832E for ; Mon, 22 Aug 2016 17:29:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D022521C1F4; Mon, 22 Aug 2016 17:29:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 042B321C1F0 for ; Mon, 22 Aug 2016 17:29:46 +0000 (UTC) Received: from vm-gentoo-x64.intern.deutschmann.biz (p2003000611285F34396ED2C8CA386A1B.dip0.t-ipconnect.de [IPv6:2003:6:1128:5f34:396e:d2c8:ca38:6a1b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: whissi) by smtp.gentoo.org (Postfix) with ESMTPSA id 0037C340662 for ; Mon, 22 Aug 2016 17:29:43 +0000 (UTC) From: Thomas Deutschmann To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH v2] eutils.eclass: Show death notice only when user patches were really applied Date: Mon, 22 Aug 2016 19:29:03 +0200 Message-Id: <20160822172903.103838-1-whissi@gentoo.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160821221448.61119-1-whissi@gentoo.org> References: <20160821221448.61119-1-whissi@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: c311f8ac-2219-4592-a0ad-3e97645c91b5 X-Archives-Hash: df59100993521ded9b24704caa753c9d As part of the user requested feature from [Gentoo-Bug #543878] eutils.eclass shows a warning regarding user applied patches in case of an error [Link 1]. However this warning will always be shown even if no user patch were applied at all (example: empty /etc/portage// directory). This commit adds a new global variable "EPATCH_N_APPLIED_PATCHES" which tracks the number of applied user patches. This allows us to only show the notice when user patches were really applied. Link: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?r1=1.443&r2=1.444 Gentoo-Bug: https://bugs.gentoo.org/543878 --- eclass/eutils.eclass | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index dbedffe..27b542c 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -292,6 +292,10 @@ EPATCH_OPTS="" # -E - automatically remove empty files # @CODE EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch" +# @VARIABLE: EPATCH_N_APPLIED_PATCHES +# @DESCRIPTION: +# Counter variable which indicates how many patches were applied. +EPATCH_N_APPLIED_PATCHES=0 # @VARIABLE: EPATCH_EXCLUDE # @DESCRIPTION: # List of patches not to apply. Note this is only file names, @@ -595,6 +599,8 @@ epatch() { : $(( count++ )) done + (( EPATCH_N_APPLIED_PATCHES++ )) + # if we had to decompress the patch, delete the temp one if [[ -n ${PIPE_CMD} ]] ; then rm -f "${PATCH_TARGET}" @@ -1736,13 +1742,17 @@ epatch_user() { [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check} [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check} if [[ -d ${EPATCH_SOURCE} ]] ; then + local old_n_applied_patches=${EPATCH_N_APPLIED_PATCHES} EPATCH_SOURCE=${EPATCH_SOURCE} \ EPATCH_SUFFIX="patch" \ EPATCH_FORCE="yes" \ EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ epatch echo "${EPATCH_SOURCE}" > "${applied}" - has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice" + if [[ ${old_n_applied_patches} -lt ${EPATCH_N_APPLIED_PATCHES} ]]; then + has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || \ + EBUILD_DEATH_HOOKS+=" epatch_user_death_notice" + fi return 0 fi done -- 2.9.3