commit:     9ea780739f2489611da13223acf87ce3780bef6a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 12 12:19:15 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 24 04:35:28 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ea78073

Remove unpack support for 7z, lha and rar in EAPI 8

Bug: https://bugs.gentoo.org/690968
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/eapi.sh          | 12 ++++++++++++
 bin/phase-helpers.sh | 26 +++++++++++++++++++-------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index b03871690..a999c68e6 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -186,6 +186,18 @@ ___eapi_unpack_supports_txz() {
        [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress)$ ]]
 }
 
+___eapi_unpack_supports_7z() {
+       [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
+___eapi_unpack_supports_lha() {
+       [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
+___eapi_unpack_supports_rar() {
+       [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
 ___eapi_econf_passes_--disable-dependency-tracking() {
        [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 7a82dad20..6294f6a5c 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -429,11 +429,15 @@ unpack() {
                                __unpack_tar 
"${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}"
                                ;;
                        7z)
-                               local my_output
-                               my_output="$(7z x -y "${srcdir}${x}")"
-                               if [ $? -ne 0 ]; then
-                                       echo "${my_output}" >&2
-                                       die "$myfail"
+                               if ___eapi_unpack_supports_7z; then
+                                       local my_output
+                                       my_output="$(7z x -y "${srcdir}${x}")"
+                                       if [ $? -ne 0 ]; then
+                                               echo "${my_output}" >&2
+                                               die "$myfail"
+                                       fi
+                               else
+                                       __vecho "unpack ${x}: file format not 
recognized. Ignoring."
                                fi
                                ;;
                        rar)
@@ -443,7 +447,11 @@ unpack() {
                                                "suffix '${suffix}' which is 
unofficially supported" \
                                                "with EAPI '${EAPI}'. Instead 
use 'rar' or 'RAR'."
                                fi
-                               unrar x -idq -o+ "${srcdir}${x}" || die 
"$myfail"
+                               if ___eapi_unpack_supports_rar; then
+                                       unrar x -idq -o+ "${srcdir}${x}" || die 
"$myfail"
+                               else
+                                       __vecho "unpack ${x}: file format not 
recognized. Ignoring."
+                               fi
                                ;;
                        lha|lzh)
                                if ___eapi_unpack_is_case_sensitive && \
@@ -453,7 +461,11 @@ unpack() {
                                                "with EAPI '${EAPI}'." \
                                                "Instead use 'LHA', 'LHa', 
'lha', or 'lzh'."
                                fi
-                               lha xfq "${srcdir}${x}" || die "$myfail"
+                               if ___eapi_unpack_supports_lha; then
+                                       lha xfq "${srcdir}${x}" || die "$myfail"
+                               else
+                                       __vecho "unpack ${x}: file format not 
recognized. Ignoring."
+                               fi
                                ;;
                        a)
                                if ___eapi_unpack_is_case_sensitive && \

Reply via email to