commit:     7190427fde83db4fea59bd317995fa156941d796
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jul 27 01:06:22 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 08:14:18 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7190427f

phase-helpers.sh: use parameter expansion to convert to lowercase

Drop the y_insensitive and suffix_insensitive variables. Given at least
bash-4.2 as a target, the ${param,,} expansion form can be used to
convert to lowercase instead.

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

 bin/phase-helpers.sh | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index addbdbeef0..4df7a2010d 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -328,8 +328,8 @@ use_enable() {
 unpack() {
        local srcdir
        local x
-       local y y_insensitive
-       local suffix suffix_insensitive
+       local y
+       local suffix
        local suffix_known
        local myfail
 
@@ -337,10 +337,8 @@ unpack() {
 
        for x in "$@"; do
                suffix=${x##*.}
-               suffix_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< 
"${suffix}")
                y=${x%.*}
                y=${y##*.}
-               y_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}")
 
                # wrt PMS 12.3.15 Misc Commands
                if [[ ${x} != */* ]]; then
@@ -369,7 +367,7 @@ unpack() {
                [[ ! -s ${srcdir}${x} ]] && die "unpack: ${x} does not exist"
 
                suffix_known=""
-               case ${suffix_insensitive} in
+               case ${suffix,,} in
                        tar|tgz|tbz2|tbz|zip|jar|gz|z|bz2|bz|a|deb|lzma) 
suffix_known=1 ;;
                        7z)      ___eapi_unpack_supports_7z  && suffix_known=1 
;;
                        rar)     ___eapi_unpack_supports_rar && suffix_known=1 
;;
@@ -379,7 +377,7 @@ unpack() {
                esac
 
                if ___eapi_unpack_is_case_sensitive \
-                               && [[ ${suffix} != 
@("${suffix_insensitive}"|ZIP|Z|7Z|RAR|LH[Aa]) ]]; then
+                               && [[ ${suffix} != 
@("${suffix,,}"|ZIP|Z|7Z|RAR|LH[Aa]) ]]; then
                        suffix_known=""
                fi
 
@@ -391,7 +389,7 @@ unpack() {
                fi
 
                __unpack_tar() {
-                       if [[ ${y_insensitive} == tar ]] \
+                       if [[ ${y,,} == tar ]] \
                                        && ! ___eapi_unpack_is_case_sensitive \
                                        || [[ ${y} == tar ]]; then
                                $1 -c -- "${srcdir}${x}" | tar xof -
@@ -404,7 +402,7 @@ unpack() {
                }
 
                myfail="unpack: failure unpacking ${x}"
-               case "${suffix_insensitive}" in
+               case ${suffix,,} in
                        tar)
                                tar xof "${srcdir}${x}" || die "${myfail}"
                                ;;

Reply via email to