commit:     297c50c0369dca15b109f81a9c5f35df870412de
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 30 12:13:42 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 15 10:37:55 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=297c50c0

phase-helpers.sh: order case patterns alphabetically in unpack()

As concerns the unpack() function, order the patterns specified by the
second of its case statements alphabetically. This is in advance of a
refactoring that shall incorporate a bug fix.

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

 bin/phase-helpers.sh | 62 ++++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 68009fcc0e..fa33090dec 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -414,44 +414,19 @@ unpack() {
                fi
 
                case ${suffix,,} in
-                       tar)
-                               tar xof "${srcdir}${f}"
-                               ;;
-                       tgz)
-                               tar xozf "${srcdir}${f}"
-                               ;;
-                       tbz|tbz2)
-                               (( ${#bzip2_cmd[@]} )) || __compose_bzip2_cmd
-                               "${bzip2_cmd[@]}" -c -- "${srcdir}${f}" | tar 
xof -
-                               ;;
-                       zip|jar)
-                               # unzip will interactively prompt under some 
error conditions,
-                               # as reported in bug #336285. Inducing EOF on 
STDIN makes for
-                               # an adequate countermeasure.
-                               unzip -qo "${srcdir}${f}" </dev/null
-                               ;;
-                       gz|z)
-                               __unpack_tar gzip -d
-                               ;;
-                       bz2|bz)
-                               (( ${#bzip2_cmd[@]} )) || __compose_bzip2_cmd
-                               __unpack_tar "${bzip2_cmd[@]}"
-                               ;;
                        7z)
                                if ! output=$(7z x -y "${srcdir}${f}"); then
                                        printf '%s\n' "${output}" >&2
                                        false
                                fi
                                ;;
-                       rar)
-                               unrar x -idq -o+ "${srcdir}${f}"
-                               ;;
-                       lha|lzh)
-                               lha xfq "${srcdir}${f}"
-                               ;;
                        a)
                                ar x "${srcdir}${f}"
                                ;;
+                       bz|bz2)
+                               (( ${#bzip2_cmd[@]} )) || __compose_bzip2_cmd
+                               __unpack_tar "${bzip2_cmd[@]}"
+                               ;;
                        deb)
                                # Unpacking .deb archives can not always be 
done with
                                # `ar`.  For instance on AIX this doesn't work 
out.
@@ -475,15 +450,40 @@ unpack() {
                                        ar x "${srcdir}${f}"
                                fi
                                ;;
+                       gz|z)
+                               __unpack_tar gzip -d
+                               ;;
+                       jar|zip)
+                               # unzip will interactively prompt under some 
error conditions,
+                               # as reported in bug #336285. Inducing EOF on 
STDIN makes for
+                               # an adequate countermeasure.
+                               unzip -qo "${srcdir}${f}" </dev/null
+                               ;;
+                       lha|lzh)
+                               lha xfq "${srcdir}${f}"
+                               ;;
                        lzma)
                                __unpack_tar lzma -d
                                ;;
-                       xz)
-                               __unpack_tar xz -T"$(___makeopts_jobs)" -d
+                       rar)
+                               unrar x -idq -o+ "${srcdir}${f}"
+                               ;;
+                       tar)
+                               tar xof "${srcdir}${f}"
+                               ;;
+                       tbz|tbz2)
+                               (( ${#bzip2_cmd[@]} )) || __compose_bzip2_cmd
+                               "${bzip2_cmd[@]}" -c -- "${srcdir}${f}" | tar 
xof -
+                               ;;
+                       tgz)
+                               tar xozf "${srcdir}${f}"
                                ;;
                        txz)
                                XZ_OPT="-T$(___makeopts_jobs)" tar xof 
"${srcdir}${f}"
                                ;;
+                       xz)
+                               __unpack_tar xz -T"$(___makeopts_jobs)" -d
+                               ;;
                esac || die "unpack: failure unpacking ${f@Q}"
        done
 

Reply via email to