configure: xz-utils alone can also handle LZMA-compressed tarballs
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Aug 26 00:07:51 2011 +0200 (2011-08-26)
changeset 2646e5078db4bd2c
parent 2645 9cb3554bebeb
child 2647 cb0f31fe2535
configure: xz-utils alone can also handle LZMA-compressed tarballs

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
configure
scripts/functions
     1.1 --- a/configure	Thu Aug 25 18:30:18 2011 +0200
     1.2 +++ b/configure	Fri Aug 26 00:07:51 2011 +0200
     1.3 @@ -506,6 +506,7 @@
     1.4               err="xz-compressed tarballs will not be used"
     1.5  has_or_warn  prog=lzma                                      \
     1.6               kconfig=has_lzma                               \
     1.7 +             skip="${has_xzutils}"                          \
     1.8               err="lzma-compressed tarballs will not be used"
     1.9  has_or_abort prog=readlink
    1.10  has_or_abort prog=objcopy var=objcopy
     2.1 --- a/scripts/functions	Thu Aug 25 18:30:18 2011 +0200
     2.2 +++ b/scripts/functions	Fri Aug 26 00:07:51 2011 +0200
     2.3 @@ -403,7 +403,8 @@
     2.4      if [ "${CT_CONFIGURE_has_xzutils}" = "y" ]; then
     2.5          printf ".tar.xz\n"
     2.6      fi
     2.7 -    if [ "${CT_CONFIGURE_has_lzma}" = "y" ]; then
     2.8 +    if [    "${CT_CONFIGURE_has_lzma}" = "y"    \
     2.9 +         -o "${CT_CONFIGURE_has_xzutils}" = "y" ]; then
    2.10          printf ".tar.lzma\n"
    2.11      fi
    2.12      printf ".tar.bz2\n"
    2.13 @@ -717,6 +718,7 @@
    2.14      local nochdir="$1"
    2.15      local basename
    2.16      local ext
    2.17 +    local lzma_prog
    2.18      local -a tar_opts
    2.19  
    2.20      if [ "${nochdir}" = "nochdir" ]; then
    2.21 @@ -758,9 +760,20 @@
    2.22      tar_opts=( "--strip-components=1" )
    2.23      tar_opts+=( "-C" "${basename}" )
    2.24      tar_opts+=( "-xv" )
    2.25 +
    2.26 +    # One note here:
    2.27 +    # - lzma can be handled either with 'xz' or 'lzma'
    2.28 +    # - we get lzma tarball only if either or both are available
    2.29 +    # - so, if we get an lzma tarball, and either 'xz' or 'lzma' is
    2.30 +    #   missing, we can assume the other is available
    2.31 +    if [ "${CT_CONFIGURE_has_lzma}" = "y" ]; then
    2.32 +        lzma_prog=lzma
    2.33 +    else
    2.34 +        lzma_prog=xz
    2.35 +    fi
    2.36      case "${ext}" in
    2.37          .tar.xz)      CT_DoExecLog FILE tar "${tar_opts[@]}" --use-compress-program=xz -f "${full_file}";;
    2.38 -        .tar.lzma)    CT_DoExecLog FILE tar "${tar_opts[@]}" --use-compress-program=lzma -f "${full_file}";;
    2.39 +        .tar.lzma)    CT_DoExecLog FILE tar "${tar_opts[@]}" --use-compress-program="${lzma_prog}" -f "${full_file}";;
    2.40          .tar.bz2)     CT_DoExecLog FILE tar "${tar_opts[@]}" -j -f "${full_file}";;
    2.41          .tar.gz|.tgz) CT_DoExecLog FILE tar "${tar_opts[@]}" -z -f "${full_file}";;
    2.42          .tar)         CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}";;