commit: 61288b20224011dd24b97eeff5bc14807768a309
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri May 30 06:28:18 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 1 21:42:00 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=61288b20
phase-helpers.sh: drop the _eapply_get_files() helper function
Now that the eapply() function has been subjected to a much-needed
refactoring, it is plain to see that the continued existence of the
_eapply_get_files() function cannot be justified. Inline the code and
dispense with the duly obsoleted 'files' array variable.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/phase-helpers.sh | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index ddc446d738..7defd9f984 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -978,18 +978,8 @@ fi
if ___eapi_has_eapply; then
eapply() {
- local f patch_cmd path
- local -a files operands options
-
- _eapply_get_files() {
- local LC_ALL=POSIX f
-
- for f in "${1}"/*; do
- if [[ ${f} == *.@(diff|patch) ]]; then
- files+=( "${f}" )
- fi
- done
- }
+ local LC_ALL LC_COLLATE=C f i patch_cmd path
+ local -a operands options
_eapply_patch() {
local patch=$1 prefix=$2
@@ -1046,16 +1036,18 @@ if ___eapi_has_eapply; then
for path in "${operands[@]}"; do
if [[ -d ${path} ]]; then
- files=()
- _eapply_get_files "${path}"
- if [[ ${#files[@]} -eq 0 ]]; then
+ i=0
+ for f in "${path}"/*; do
+ if [[ ${f} == *.@(diff|patch) ]]; then
+ if (( i++ == 0 )); then
+ einfo "Applying patches
from ${path} ..."
+ fi
+ _eapply_patch "${f}" ' '
"${options[@]}" || return
+ fi
+ done
+ if (( i == 0 )); then
die "No *.{patch,diff} files in
directory ${path}"
fi
-
- einfo "Applying patches from ${path} ..."
- for f in "${files[@]}"; do
- _eapply_patch "${f}" ' '
"${options[@]}" || return
- done
else
_eapply_patch "${path}" '' "${options[@]}" ||
return
fi