aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-09-09 17:30:25 +0200
committerUlrich Müller <ulm@gentoo.org>2024-09-10 12:29:10 +0200
commit6e454ea3b8e5e1aa0f4d9efcb42759dc5ec0ec99 (patch)
tree72e7914cd0578ddc7d97aee0fbcc39d4bd695319
parentinstall-qa-check.d: try to detect gcc warnings past color (diff)
downloadportage-6e454ea3b8e5e1aa0f4d9efcb42759dc5ec0ec99.tar.gz
portage-6e454ea3b8e5e1aa0f4d9efcb42759dc5ec0ec99.tar.bz2
portage-6e454ea3b8e5e1aa0f4d9efcb42759dc5ec0ec99.zip
unpack: Don't display "Unpacking ..." for skipped files
PMS says that "Any unrecognised file format shall be skipped silently." This wording was added with the draft of what later became EAPI 4: https://gitweb.gentoo.org/proj/pms.git/commit/?id=634c32f231e1bc94d64588e2b2edf0ad1ca60f1f The commit message doesn't give any rationale for "silently". It may well be that the wording is a remnant of the rejected "unpack --if-compressed" item. See the discussion in the 2009-04-23 council meeting: https://projects.gentoo.org/council/meeting-logs/20090423.txt (starting at 21:35). Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--bin/phase-helpers.sh49
1 files changed, 28 insertions, 21 deletions
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 77132eb06..164f62143 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
if ___eapi_has_DESTTREE_INSDESTTREE; then
@@ -321,13 +321,13 @@ unpack() {
local x
local y y_insensitive
local suffix suffix_insensitive
+ local suffix_known
local myfail
local eapi=${EAPI:-0}
[[ -z "$*" ]] && die "Nothing passed to the 'unpack' command"
for x in "$@"; do
- __vecho ">>> Unpacking ${x} to ${PWD}"
suffix=${x##*.}
suffix_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${suffix}")
y=${x%.*}
@@ -360,6 +360,23 @@ unpack() {
fi
[[ ! -s ${srcdir}${x} ]] && die "unpack: ${x} does not exist"
+ suffix_known=""
+ case ${suffix_insensitive} 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 [[ -n ${suffix_known} ]]; then
+ __vecho ">>> Unpacking ${x} to ${PWD}"
+ else
+ __vecho "=== Skipping unpack of ${x}"
+ continue
+ fi
+
__unpack_tar() {
if [[ ${y_insensitive} == tar ]] ; then
if ___eapi_unpack_is_case_sensitive && \
@@ -439,13 +456,11 @@ unpack() {
__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}"
;;
7z)
- 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
+ local my_output
+ my_output="$(7z x -y "${srcdir}${x}")"
+ if [[ $? -ne 0 ]]; then
+ echo "${my_output}" >&2
+ die "${myfail}"
fi
;;
rar)
@@ -455,9 +470,7 @@ unpack() {
"suffix '${suffix}' which is unofficially supported" \
"with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'."
fi
- if ___eapi_unpack_supports_rar; then
- unrar x -idq -o+ "${srcdir}${x}" || die "${myfail}"
- fi
+ unrar x -idq -o+ "${srcdir}${x}" || die "${myfail}"
;;
lha|lzh)
if ___eapi_unpack_is_case_sensitive && \
@@ -467,9 +480,7 @@ unpack() {
"with EAPI '${EAPI}'." \
"Instead use 'LHA', 'LHa', 'lha', or 'lzh'."
fi
- if ___eapi_unpack_supports_lha; then
- lha xfq "${srcdir}${x}" || die "${myfail}"
- fi
+ lha xfq "${srcdir}${x}" || die "${myfail}"
;;
a)
if ___eapi_unpack_is_case_sensitive && \
@@ -537,9 +548,7 @@ unpack() {
"suffix '${suffix}' which is unofficially supported" \
"with EAPI '${EAPI}'. Instead use 'xz'."
fi
- if ___eapi_unpack_supports_xz; then
- __unpack_tar "xz -T$(___makeopts_jobs) -d"
- fi
+ __unpack_tar "xz -T$(___makeopts_jobs) -d"
;;
txz)
if ___eapi_unpack_is_case_sensitive && \
@@ -548,9 +557,7 @@ unpack() {
"suffix '${suffix}' which is unofficially supported" \
"with EAPI '${EAPI}'. Instead use 'txz'."
fi
- if ___eapi_unpack_supports_txz; then
- XZ_OPT="-T$(___makeopts_jobs)" tar xof "${srcdir}${x}" || die "${myfail}"
- fi
+ XZ_OPT="-T$(___makeopts_jobs)" tar xof "${srcdir}${x}" || die "${myfail}"
;;
esac
done