summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-12-13 21:02:58 +0000
committerMichał Górny <mgorny@gentoo.org>2022-12-14 11:16:17 +0100
commit7713a9f0fc204a09d6b2a57a46e520f07bed72be (patch)
tree65cef06f3ebef1f4cdb26cd8853f1e86d28ff09d
parentpython-utils.eclass: Bump minimal Python versions (diff)
downloadgentoo-7713a9f0fc204a09d6b2a57a46e520f07bed72be.tar.gz
gentoo-7713a9f0fc204a09d6b2a57a46e520f07bed72be.tar.bz2
gentoo-7713a9f0fc204a09d6b2a57a46e520f07bed72be.zip
unpacker.eclass: support >=app-arch/xz-utils-5.4.0 for lzip decompression
>=app-arch/xz-utils-5.4.0 supports lzip decompression (not compression). Add support for unpacker.eclass to handle it for .lz files. Note that xz-utils is part of @system (and PMS requires that .xz is unpackable), while most users do not have lzip and friends installed. (Note that xz does not (currently, but does not plan on either) implement parallel decompression for .lz, but most .lz distfiles are small, so this isn't an issue.) Historically, we've often repacked .lz distfiles for important packages to avoid users needing to install app-arch/lzip for a single distfile, so this avoids the need for that (although I've not done it out of principle for things like sys-apps/ed). Bug: https://bugs.gentoo.org/249059 Bug: https://bugs.gentoo.org/485462 Bug: https://bugs.gentoo.org/501912 Bug: https://bugs.gentoo.org/502990 Bug: https://bugs.gentoo.org/545344 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--eclass/unpacker.eclass31
1 files changed, 27 insertions, 4 deletions
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 3d8bf7a8452d..11f04fde7226 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -30,7 +30,7 @@ inherit multiprocessing toolchain-funcs
# @DEFAULT_UNSET
# @DESCRIPTION:
# Utility to use to decompress bzip2 files. Will dynamically pick between
-# `lbzip2`, `pbzip2` and `bzip2`. Make sure your choice accepts the "-dc"
+# `lbzip2`, `pbzip2`, and `bzip2`. Make sure your choice accepts the "-dc"
# options.
# Note: this is meant for users to set, not ebuilds.
@@ -39,7 +39,7 @@ inherit multiprocessing toolchain-funcs
# @DEFAULT_UNSET
# @DESCRIPTION:
# Utility to use to decompress lzip files. Will dynamically pick between
-# `plzip`, `pdlzip` and `lzip`. Make sure your choice accepts the "-dc" options.
+# `xz`, `plzip`, `pdlzip`, and `lzip`. Make sure your choice accepts the "-dc" options.
# Note: this is meant for users to set, not ebuilds.
# for internal use only (unpack_pdv and unpack_makeself)
@@ -429,7 +429,22 @@ _unpacker_get_decompressor() {
*.lzma|*.xz|*.txz)
echo "xz -T$(makeopts_jobs) -dc" ;;
*.lz)
- : ${UNPACKER_LZIP:=$(type -P plzip || type -P pdlzip || type -P lzip)}
+ find_lz_unpacker() {
+ local has_version_arg="-b"
+
+ [[ ${EAPI} == 6 ]] && has_version_arg="--host-root"
+ if has_version "${has_version_arg}" ">=app-arch/xz-utils-5.4.0" ; then
+ echo xz
+ return
+ fi
+
+ local x
+ for x in plzip pdlzip lzip ; do
+ type -P ${x} && break
+ done
+ }
+
+ : ${UNPACKER_LZIP:=$(find_lz_unpacker)}
echo "${UNPACKER_LZIP} -dc" ;;
*.zst)
echo "zstd -dc" ;;
@@ -604,7 +619,15 @@ unpacker_src_uri_depends() {
*.zip)
d="app-arch/unzip" ;;
*.lz)
- d="|| ( app-arch/plzip app-arch/pdlzip app-arch/lzip )" ;;
+ d="
+ || (
+ >=app-arch/xz-utils-5.4.0
+ app-arch/plzip
+ app-arch/pdlzip
+ app-arch/lzip
+ )
+ "
+ ;;
*.zst)
d="app-arch/zstd" ;;
*.lha|*.lzh)