Skip to content

Commit

Permalink
unpacker.eclass: support >=app-arch/xz-utils-5.4.0 for lzip decompres…
Browse files Browse the repository at this point in the history
…sion

>=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 <[email protected]>
Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
thesamesam authored and mgorny committed Dec 14, 2022
1 parent 5f2ae4f commit 7713a9f
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions eclass/unpacker.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)
Expand Down Expand Up @@ -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" ;;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7713a9f

Please sign in to comment.