commit:     eba088af8f335c0adb386461e6df1267e24800e7
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  3 18:52:09 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Jul  3 18:58:37 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=eba088af

Revert "ebegin/eend: accept properly nested calls in different functions"

ebegin calls should not be nested: this will lead to strange looking
output in the log file. For example:

 * Doing task 1 ...
 * Doint task 2 ... [ ok ]
                    [ ok ]

Reverts: 605ad0d675a64eb39144122cf284100192cdfea0
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 bin/isolated-functions.sh | 22 ++++------------------
 bin/phase-functions.sh    |  4 +---
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 848e44b04..dea0d7f49 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -340,15 +340,9 @@ ebegin() {
        LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} ))
        LAST_E_CMD="ebegin"
        if [[ -v EBEGIN_EEND ]] ; then
-               # Already a call to ebegin
-               local prev="${EBEGIN_EEND[-1]}"
-               if [[ "${prev}" == "${FUNCNAME[1]}" ]] ; then
-                       eqawarn "QA Notice: ebegin called in ${prev}, but 
missing call to eend (${FUNCNAME[1]})"
-               fi
-               EBEGIN_EEND+=( "${FUNCNAME[1]}" )
-       else
-               EBEGIN_EEND=( "${FUNCNAME[1]}" )
+               eqawarn "QA Notice: ebegin called, but missing call to eend 
(phase: ${EBUILD_PHASE})"
        fi
+       EBEGIN_EEND=1
        return 0
 }
 
@@ -378,17 +372,9 @@ __eend() {
 eend() {
        [[ -n $1 ]] || eqawarn "QA Notice: eend called without first argument"
        if [[ -v EBEGIN_EEND ]] ; then
-               local caller="${FUNCNAME[1]}"
-               local tos="${EBEGIN_EEND[-1]}"
-               if [[ "${caller}" != "${tos}" ]] ; then
-                       eqawarn "QA Notice: eend (in ${caller}) improperly 
matched with ebegin (called in ${tos})"
-               fi
-               unset EBEGIN_EEND[-1]
-               if [[ ${#EBEGIN_EEND[@]} -eq 0 ]] ; then
-                       unset EBEGIN_EEND
-               fi
+               unset EBEGIN_EEND
        else
-               eqawarn "QA Notice: eend called without preceding ebegin 
(phase: ${FUNCNAME[1]})"
+               eqawarn "QA Notice: eend called without preceding ebegin 
(phase: ${EBUILD_PHASE})"
        fi
        local retval=${1:-0}
        shift

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 0a36af297..25e25cc1e 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -1089,9 +1089,7 @@ __ebuild_main() {
        esac
 
        if [[ -v EBEGIN_EEND ]] ; then
-               for func in "${EBEGIN_EEND[@]}" ; do
-                       eqawarn "QA Notice: ebegin called in ${func} but 
missing call to eend"
-               done
+               eqawarn "QA Notice: ebegin called, but missing call to eend 
(phase: ${1})"
        fi
 
        # Save the env only for relevant phases.

Reply via email to