commit:     99d2d256525e79728ad7dc1431f5e909460f9f8b
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jun  7 18:14:16 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  7 22:54:15 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=99d2d256

ecompress: rename several variables in fix_symlinks()

As regards the fix_symlinks() function, rename the 'brokenlink' variable
to 'link', the 'olddest' variable to 'target1', and the 'newdest'
variable to 'target2'. Following this change, I find the code slightly
easier to follow at a glance.

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

 bin/ecompress | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index 7e13c182f4..e77347eed5 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -132,26 +132,26 @@ guess_suffix() {
 }
 
 fix_symlinks() {
-       local something_changed brokenlink newdest olddest i
+       local something_changed link target1 target2 i
 
        # Repeat until nothing changes, in order to handle multiple
        # levels of indirection (see bug #470916).
        while true ; do
                something_changed=0
-               while IFS= read -rd '' brokenlink; do
-                       [[ -e ${brokenlink} ]] && continue
+               while IFS= read -rd '' link; do
+                       [[ -e ${link} ]] && continue
 
-                       olddest=$(readlink -- "${brokenlink}")
-                       newdest=${olddest}${PORTAGE_COMPRESS_SUFFIX}
-                       if [[ "${newdest}" == /* ]] ; then
-                               [[ -f "${D%/}${newdest}" ]] || continue
+                       target1=$(readlink -- "${link}")
+                       target2=${target1}${PORTAGE_COMPRESS_SUFFIX}
+                       if [[ "${target2}" == /* ]] ; then
+                               [[ -f "${D%/}${target2}" ]] || continue
                        else
-                               [[ -f "${brokenlink%/*}/${newdest}" ]] || 
continue
+                               [[ -f "${link%/*}/${target2}" ]] || continue
                        fi
 
                        something_changed=1
-                       rm -f -- "${brokenlink}" \
-                       && ln -snf -- "${newdest}" 
"${brokenlink}${PORTAGE_COMPRESS_SUFFIX}" \
+                       rm -f -- "${link}" \
+                       && ln -snf -- "${target2}" 
"${link}${PORTAGE_COMPRESS_SUFFIX}" \
                        || return
                done < <(printf '%s\0' "${ED}" | find0 -type l -print0)
 

Reply via email to