commit:     6f3c0cb3cc826f355b34dafcbfee345f344f28ea
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jul 13 09:48:04 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 22 22:25:38 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6f3c0cb3

phase-helpers.sh: hoist locals to the top of eapply_user()

Local variables are not lexically scoped in bash and it has been my
experience that declaring them up-front can help to identify undue
complexity. Do so for the eapply_user() function.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/phase-helpers.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index fef77e52d7..5811a90658 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1063,23 +1063,23 @@ fi
 
 if ___eapi_has_eapply_user; then
        eapply_user() {
+               local basename basedir columns tagfile hr d f
+               local -A patch_by
+
                [[ ${EBUILD_PHASE} == prepare ]] || \
                        die "eapply_user() called during invalid phase: 
${EBUILD_PHASE}"
 
                # Keep path in __dyn_prepare in sync!
-               local tagfile=${T}/.portage_user_patches_applied
+               tagfile=${T}/.portage_user_patches_applied
                [[ -f ${tagfile} ]] && return
                >> "${tagfile}"
 
-               local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
+               basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
 
-               local columns=${COLUMNS:-0}
+               columns=${COLUMNS:-0}
                [[ ${columns} == 0 ]] && columns=$(set -- $( ( stty size 
</dev/tty ) 2>/dev/null || echo 24 80 ) ; echo $2)
                (( columns > 0 )) || (( columns = 80 ))
 
-               local -A patch_by
-               local d f basename hr
-
                # Patches from all matched directories are combined into a
                # sorted (POSIX order) list of the patch basenames. Patches
                # in more-specific directories override patches of the same

Reply via email to