commit: f22f2f6150b0d58eb85ad65e43cc7be4657c5c7a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jul 27 22:13:58 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 08:14:25 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f22f2f61
phase-helpers.sh: don't declare _eapply_get_files() repeatedly
Potentially declaring _eapply_get_files() multiple times within a loop
is hardly worth the dubious distinction of not bothering to declare at
all in the case that no directory is seen. Hoist the declaration upwards
so that it is declared early in eapply(), just as _eapply_patch()
already is.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/phase-helpers.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index eca0a08c19..726e743f0a 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -991,6 +991,16 @@ if ___eapi_has_eapply; then
# for bsd userland support, use gpatch if available
type -P gpatch > /dev/null && patch_cmd=gpatch
+ _eapply_get_files() {
+ local LC_ALL=POSIX
+ local f
+ for f in "${1}"/*; do
+ if [[ ${f} == *.@(diff|patch) ]]; then
+ files+=( "${f}" )
+ fi
+ done
+ }
+
_eapply_patch() {
local f=${1}
local prefix=${2}
@@ -1056,16 +1066,6 @@ if ___eapi_has_eapply; then
local f
for f in "${files[@]}"; do
if [[ -d ${f} ]]; then
- _eapply_get_files() {
- local LC_ALL=POSIX
- local f
- for f in "${1}"/*; do
- if [[ ${f} == *.@(diff|patch)
]]; then
- files+=( "${f}" )
- fi
- done
- }
-
local files=()
_eapply_get_files "${f}"
[[ ${#files[@]} -eq 0 ]] && die "No
*.{patch,diff} files in directory ${f}"