commit: bfa78fd3a52b12b190012f55688faf6d781c2368
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun 9 20:00:05 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 11 03:26:18 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bfa78fd3
estrip: reduce the degree of indentation in do_queue()
Reduce the maximal degree of indentation reached by the do_queue()
function. As much as I like structured code, it was going a little
overboard.
See-also: e1350e68e944ea2b8972f1303635a29c7f77c05d
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/estrip | 86 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/bin/estrip b/bin/estrip
index 6a0fab2bda..06df136a4f 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -351,50 +351,50 @@ do_queue() {
fi
done
- if (( ${#find_paths[@]} )); then
- # We can avoid scanelf calls for binaries we already
- # checked in install_qa_check (where we generate
- # NEEDED for everything installed).
- #
- # EAPI 7+ has controlled stripping (dostrip) though
- # which is why estrip has the queue/dequeue logic,
- # so we need to take the intersection of:
- # 1. files scanned earlier (all ELF installed)
- # (note that this should be a superset of 2., so we don't
- # need to worry about unknown files appearing)
- #
- # 2. the files we're interested in right now
- if [[ -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED ]] ; then
- # The arguments may not be exact files (probably
aren't), but search paths/directories
- # which should then be searched recursively.
- while IFS= read -r needed_entry ; do
- for find_path in "${find_paths[@]}" ; do
- # NEEDED has a bunch of entries like:
- # /usr/lib64/libfoo.so libc.so
- #
- # find_path entries may be exact paths
(like /usr/lib64/libfoo.so)
- # or instead /usr/lib64, or ${ED}/usr,
etc.
- #
- # We check if the beginning (i.e. first
entry) of the NEEDED line
- # matches the path given
- # e.g. find_path="/usr/lib64" will
match needed_entry="/usr/lib64/libfoo.so libc.so".
- needed_entry_file="${needed_entry% *}"
- if [[ "${needed_entry_file}" =~
^${find_path##"${D}"} ]] ; then
- scanelf_results+=(
"${D}${needed_entry_file}" )
- fi
- done
- done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED
- else
- mapfile -t scanelf_results < <(scanelf -yqRBF '#k%F' -k
'.symtab' "${find_paths[@]}")
- fi
-
- while IFS= read -r path; do
- >> "${path}.estrip" || die
- done < <(
- (( ${#scanelf_results[@]} )) && printf "%s\n"
"${scanelf_results[@]}"
- find "${find_paths[@]}" -type f ! -type l -name '*.a'
- )
+ (( ${#find_paths[@]} )) || return 0
+
+ # We can avoid scanelf calls for binaries we already
+ # checked in install_qa_check (where we generate
+ # NEEDED for everything installed).
+ #
+ # EAPI 7+ has controlled stripping (dostrip) though
+ # which is why estrip has the queue/dequeue logic,
+ # so we need to take the intersection of:
+ # 1. files scanned earlier (all ELF installed)
+ # (note that this should be a superset of 2., so we don't
+ # need to worry about unknown files appearing)
+ #
+ # 2. the files we're interested in right now
+ if [[ -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED ]] ; then
+ # The arguments may not be exact files (probably aren't), but
search paths/directories
+ # which should then be searched recursively.
+ while IFS= read -r needed_entry ; do
+ for find_path in "${find_paths[@]}" ; do
+ # NEEDED has a bunch of entries like:
+ # /usr/lib64/libfoo.so libc.so
+ #
+ # find_path entries may be exact paths (like
/usr/lib64/libfoo.so)
+ # or instead /usr/lib64, or ${ED}/usr, etc.
+ #
+ # We check if the beginning (i.e. first entry)
of the NEEDED line
+ # matches the path given
+ # e.g. find_path="/usr/lib64" will match
needed_entry="/usr/lib64/libfoo.so libc.so".
+ needed_entry_file="${needed_entry% *}"
+ if [[ "${needed_entry_file}" =~
^${find_path##"${D}"} ]] ; then
+ scanelf_results+=(
"${D}${needed_entry_file}" )
+ fi
+ done
+ done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+ else
+ mapfile -t scanelf_results < <(scanelf -yqRBF '#k%F' -k
'.symtab' "${find_paths[@]}")
fi
+
+ while IFS= read -r path; do
+ >> "${path}.estrip" || die
+ done < <(
+ (( ${#scanelf_results[@]} )) && printf "%s\n"
"${scanelf_results[@]}"
+ find "${find_paths[@]}" -type f ! -type l -name '*.a'
+ )
}
declare -A has_feature