commit:     72b961539a4a9ef61802958705478216746eafb7
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue May 27 02:36:17 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 08:14:20 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=72b96153

phase-helpers.sh: eliminate a useless use of elif in unpack()

In unpack(), the invocation of ___eapi_unpack_supports_absolute_paths()
is granted its own if command, implying that such is necessary for the
control flow to be as intended. It is unnecessary, however.

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

 bin/phase-helpers.sh | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index ec3316c176..dc1c0b3129 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -363,22 +363,18 @@ unpack() {
                elif [[ ${f} == ./* ]]; then
                        # relative path starting with './'
                        srcdir=
-               else
-                       # non-'./' filename with path of some kind
-                       if ___eapi_unpack_supports_absolute_paths; then
-                               # EAPI 6 allows absolute and deep relative paths
-                               srcdir=
-
-                               if [[ ${f} == ${DISTDIR%/}/* ]]; then
-                                       eqawarn "QA Notice: unpack called with 
redundant \${DISTDIR} in path"
-                               fi
-                       elif [[ ${f} == ${DISTDIR%/}/* ]]; then
-                               die "Arguments to unpack() cannot begin with 
\${DISTDIR} in EAPI ${EAPI}"
-                       elif [[ ${f} == /* ]] ; then
-                               die "Arguments to unpack() cannot be absolute 
in EAPI ${EAPI}"
-                       else
-                               die "Relative paths to unpack() must be 
prefixed with './' in EAPI ${EAPI}"
+               elif ___eapi_unpack_supports_absolute_paths; then
+                       # EAPI 6 allows absolute and deep relative paths
+                       srcdir=
+                       if [[ ${f} == ${DISTDIR%/}/* ]]; then
+                               eqawarn "QA Notice: unpack called with 
redundant \${DISTDIR} in path"
                        fi
+               elif [[ ${f} == ${DISTDIR%/}/* ]]; then
+                       die "Arguments to unpack() cannot begin with 
\${DISTDIR} in EAPI ${EAPI}"
+               elif [[ ${f} == /* ]]; then
+                       die "Arguments to unpack() cannot be absolute in EAPI 
${EAPI}"
+               else
+                       die "Relative paths to unpack() must be prefixed with 
'./' in EAPI ${EAPI}"
                fi
                [[ ! -s ${srcdir}${f} ]] && die "unpack: ${f} does not exist"
 

Reply via email to