configure: xz-utils alone can also handle LZMA-compressed tarballs

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-08-26 00:07:51 +02:00
parent 04250cc896
commit 4c1666134b
2 changed files with 16 additions and 2 deletions

1
configure vendored
View File

@ -506,6 +506,7 @@ has_or_warn prog=xz \
err="xz-compressed tarballs will not be used"
has_or_warn prog=lzma \
kconfig=has_lzma \
skip="${has_xzutils}" \
err="lzma-compressed tarballs will not be used"
has_or_abort prog=readlink
has_or_abort prog=objcopy var=objcopy

View File

@ -403,7 +403,8 @@ CT_DoListTarballExt() {
if [ "${CT_CONFIGURE_has_xzutils}" = "y" ]; then
printf ".tar.xz\n"
fi
if [ "${CT_CONFIGURE_has_lzma}" = "y" ]; then
if [ "${CT_CONFIGURE_has_lzma}" = "y" \
-o "${CT_CONFIGURE_has_xzutils}" = "y" ]; then
printf ".tar.lzma\n"
fi
printf ".tar.bz2\n"
@ -717,6 +718,7 @@ CT_Extract() {
local nochdir="$1"
local basename
local ext
local lzma_prog
local -a tar_opts
if [ "${nochdir}" = "nochdir" ]; then
@ -758,9 +760,20 @@ CT_Extract() {
tar_opts=( "--strip-components=1" )
tar_opts+=( "-C" "${basename}" )
tar_opts+=( "-xv" )
# One note here:
# - lzma can be handled either with 'xz' or 'lzma'
# - we get lzma tarball only if either or both are available
# - so, if we get an lzma tarball, and either 'xz' or 'lzma' is
# missing, we can assume the other is available
if [ "${CT_CONFIGURE_has_lzma}" = "y" ]; then
lzma_prog=lzma
else
lzma_prog=xz
fi
case "${ext}" in
.tar.xz) CT_DoExecLog FILE tar "${tar_opts[@]}" --use-compress-program=xz -f "${full_file}";;
.tar.lzma) CT_DoExecLog FILE tar "${tar_opts[@]}" --use-compress-program=lzma -f "${full_file}";;
.tar.lzma) CT_DoExecLog FILE tar "${tar_opts[@]}" --use-compress-program="${lzma_prog}" -f "${full_file}";;
.tar.bz2) CT_DoExecLog FILE tar "${tar_opts[@]}" -j -f "${full_file}";;
.tar.gz|.tgz) CT_DoExecLog FILE tar "${tar_opts[@]}" -z -f "${full_file}";;
.tar) CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}";;