commit:     23c4a45827fccebb969d5130ccc234ed3d1a9b35
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Mon Apr 11 13:46:06 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 12 01:59:50 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=23c4a458

eend: Output QA warning if ebegin has not been called

The assumption here is that ebegin-eend aren't nested.

Closes: https://bugs.gentoo.org/835824
Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Closes: https://github.com/gentoo/portage/pull/807
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/isolated-functions.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index bd8c065b2..539fea952 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -339,6 +339,7 @@ ebegin() {
        [[ ${RC_ENDCOL} == "yes" ]] && echo >&2
        LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} ))
        LAST_E_CMD="ebegin"
+       EBEGIN_EEND=1
        return 0
 }
 
@@ -367,6 +368,11 @@ __eend() {
 
 eend() {
        [[ -n $1 ]] || eqawarn "QA Notice: eend called without first argument"
+       if [[ -v EBEGIN_EEND ]] ; then
+               unset EBEGIN_EEND
+       else
+               eqawarn "QA Notice: eend called without preceding ebegin 
(phase: ${EBUILD_PHASE})"
+       fi
        local retval=${1:-0}
        shift
 

Reply via email to