commit: 234904f6b10bddd93d63c4886099f89860694ca0
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon May 26 10:02:13 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 08:14:25 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=234904f6
phase-helpers.sh: clean up the handling of suffix_known
Treat the 'suffix_known' variable as a quasi-boolean by evaluating it in
the arithmetic context. Further, do away with the multitude of variable
assignments by assessing the exit status of the case command itself.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/phase-helpers.sh | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 1949230c09..7ae983ccb7 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -401,22 +401,22 @@ unpack() {
die "unpack: ${f@Q} cannot be unpacked because it is an
empty file"
fi
- suffix_known=""
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
;;
- lha|lzh) ___eapi_unpack_supports_lha && suffix_known=1
;;
- xz) ___eapi_unpack_supports_xz && suffix_known=1
;;
- txz) ___eapi_unpack_supports_txz && suffix_known=1
;;
- esac
-
- if ___eapi_unpack_is_case_sensitive \
- && [[ ${suffix} !=
@("${suffix,,}"|ZIP|Z|7Z|RAR|LH[Aa]) ]]; then
- suffix_known=""
- fi
-
- if [[ -n ${suffix_known} ]]; then
+ tar|tgz|tbz2|tbz|zip|jar|gz|z|bz2|bz|a|deb|lzma) ;;
+ 7z) ___eapi_unpack_supports_7z ;;
+ rar) ___eapi_unpack_supports_rar ;;
+ lha|lzh) ___eapi_unpack_supports_lha ;;
+ xz) ___eapi_unpack_supports_xz ;;
+ txz) ___eapi_unpack_supports_txz ;;
+ *) false ;;
+ esac \
+ && suffix_known=1
+
+ ___eapi_unpack_is_case_sensitive \
+ && [[ ${suffix} != @("${suffix,,}"|ZIP|Z|7Z|RAR|LH[Aa]) ]] \
+ && suffix_known=0
+
+ if (( suffix_known )); then
__vecho ">>> Unpacking ${f@Q} to ${PWD}"
else
__vecho "=== Skipping unpack of ${f@Q}"