commit:     4026333fa4a53b045c3b2161c38665cc303405f3
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jun  3 07:57:41 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  3 13:34:45 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4026333f

estrip: jettison the debugedit_bin and dwz_bin variables

Now that there exists a 'path_of' associative array that is already
charged with storing the paths of various other utilities, simply use
that to store the paths of debugedit(1) and dwz(1).

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

 bin/estrip | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/bin/estrip b/bin/estrip
index 27fc655995..211aece3a3 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -188,19 +188,19 @@ read -rd '' -a portage_strip_flags 
<<<"${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS}
 
 prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
 
-if ! debugedit_bin=$(type -P debugedit 2>/dev/null); then
+if ! path_of[debugedit]=$(type -P debugedit 2>/dev/null); then
        debugedit_paths=(
                "${EPREFIX}/usr/libexec/rpm/debugedit"
        )
        for x in "${debugedit_paths[@]}"; do
                if [[ -x ${x} ]]; then
-                       debugedit_bin=${x}
+                       path_of[debugedit]=${x}
                        break
                fi
        done
 fi
 
-dwz_bin=$(type -P dwz 2>/dev/null)
+path_of[dwz]=$(type -P dwz 2>/dev/null)
 
 __multijob_init
 
@@ -213,9 +213,9 @@ mkdir -p "${tmpdir}"/{inodes,splitdebug,sources}
 save_elf_sources() {
        if (( ! has_feature[installsources] || has_restriction[installsources] 
)); then
                return
-       elif [[ ! ${debugedit_bin} ]]; then
-               if [[ -v debugedit_bin ]]; then
-                       unset -v debugedit_bin
+       elif [[ ! ${path_of[debugedit]} ]]; then
+               if [[ -v 'path_of[debugedit]' ]]; then
+                       unset -v 'path_of[debugedit]'
                        ewarn "FEATURES=installsources is enabled but the 
debugedit binary could not be"
                        ewarn "found. This feature will not work unless 
debugedit is installed!"
                fi
@@ -227,7 +227,7 @@ save_elf_sources() {
        # since we're editing the ELF here, we should recompute the build-id
        # (the -i flag below).  save that output so we don't need to recompute
        # it later on in the save_elf_debug step.
-       buildid=$("${debugedit_bin}" -i \
+       buildid=$("${path_of[debugedit]}" -i \
                -b "${WORKDIR}" \
                -d "${prepstrip_sources_dir}" \
                -l "${tmpdir}/sources/${x##*/}.${BASHPID}" \
@@ -256,9 +256,9 @@ dedup_elf_debug() {
 
        debug-print-function "${FUNCNAME}" "$@"
 
-       if [[ ! ${dwz_bin} ]]; then
-               if [[ -v dwz_bin ]]; then
-                       unset -v dwz_bin
+       if [[ ! ${path_of[dwz]} ]]; then
+               if [[ -v 'path_of[dwz]' ]]; then
+                       unset -v 'path_of[dwz]'
                        ewarn "FEATURES=dedupdebug is enabled but the dwz 
binary could not be"
                        ewarn "found. This feature will not work unless dwz is 
installed!"
                fi
@@ -271,7 +271,7 @@ dedup_elf_debug() {
        # We already dedupdebug-ed this inode.
        [[ -L ${inode_dedupdebug} ]] && return 0
 
-       "${dwz_bin}" -- "${src}"
+       "${path_of[dwz]}" -- "${src}"
        touch "${inode_dedupdebug}"
 }
 
@@ -596,7 +596,7 @@ __multijob_finish
 cd "${tmpdir}"/sources/ && cat -- * > "${tmpdir}/debug.sources" 2>/dev/null
 if [[ -s ${tmpdir}/debug.sources ]] \
        && (( has_feature[installsources] && ! has_restriction[installsources] 
)) \
-       && [[ ${debugedit_bin} ]]
+       && [[ ${path_of[debugedit]} ]]
 then
        __vecho "installsources: rsyncing source files"
        [[ -d ${D%/}/${prepstrip_sources_dir#/} ]] || mkdir -p 
"${D%/}/${prepstrip_sources_dir#/}"

Reply via email to