mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-02 19:16:39 +00:00
scripts/functions: compress with gzip level 3, as stated in the documentation
Thanks to Bruno Tarquini <btarquini@gmail.com> for the report.
This commit is contained in:
parent
2d54ce4a2c
commit
e87fb32624
@ -917,16 +917,18 @@ CT_DoTarballIfExists() {
|
|||||||
local tarball="$2"
|
local tarball="$2"
|
||||||
shift 2
|
shift 2
|
||||||
local -a extra_tar_opts=( "$@" )
|
local -a extra_tar_opts=( "$@" )
|
||||||
local tar_opt
|
local -a compress
|
||||||
|
|
||||||
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
y) tar_opt=-z; tar_ext=.gz;;
|
y) compress=( gzip -c -3 - ); tar_ext=.gz;;
|
||||||
*) tar_opt=; tar_ext=;;
|
*) compress=( cat - ); tar_ext=;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -d "${dir}" ]; then
|
if [ -d "${dir}" ]; then
|
||||||
CT_DoLog DEBUG " Saving '${dir}'"
|
CT_DoLog DEBUG " Saving '${dir}'"
|
||||||
CT_DoExecLog DEBUG tar c -C "${dir}" -v ${tar_opt} -f "${tarball}.tar${tar_ext}" "${extra_tar_opts[@]}" .
|
{ tar c -C "${dir}" -v -f - "${extra_tar_opts[@]}" . \
|
||||||
|
|"${compress[@]}" >"${tarball}.tar${tar_ext}" ;
|
||||||
|
} 2>&1 |sed -r -e 's/^/ /;' |CT_DoLog DEBUG
|
||||||
else
|
else
|
||||||
CT_DoLog DEBUG " Not saving '${dir}': does not exist"
|
CT_DoLog DEBUG " Not saving '${dir}': does not exist"
|
||||||
fi
|
fi
|
||||||
@ -940,18 +942,20 @@ CT_DoExtractTarballIfExists() {
|
|||||||
local dir="$2"
|
local dir="$2"
|
||||||
shift 2
|
shift 2
|
||||||
local -a extra_tar_opts=( "$@" )
|
local -a extra_tar_opts=( "$@" )
|
||||||
local tar_opt
|
local -a uncompress
|
||||||
|
|
||||||
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
y) tar_opt=-z; tar_ext=.gz;;
|
y) uncompress=( gzip -c -d ); tar_ext=.gz;;
|
||||||
*) tar_opt=; tar_ext=;;
|
*) uncompress=( cat ); tar_ext=;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -f "${tarball}.tar${tar_ext}" ]; then
|
if [ -f "${tarball}.tar${tar_ext}" ]; then
|
||||||
CT_DoLog DEBUG " Restoring '${dir}'"
|
CT_DoLog DEBUG " Restoring '${dir}'"
|
||||||
CT_DoForceRmdir "${dir}"
|
CT_DoForceRmdir "${dir}"
|
||||||
CT_DoExecLog DEBUG mkdir -p "${dir}"
|
CT_DoExecLog DEBUG mkdir -p "${dir}"
|
||||||
CT_DoExecLog DEBUG tar x -C "${dir}" -v ${tar_opt} -f "${tarball}.tar${tar_ext}" "${extra_tar_opts[@]}"
|
{ "${uncompress[@]}" "${tarball}.tar${tar_ext}" \
|
||||||
|
|tar x -C "${dir}" -v -f - "${extra_tar_opts[@]}" ;
|
||||||
|
} 2>&1 |sed -r -e 's/^/ /;' |CT_DoLog DEBUG
|
||||||
else
|
else
|
||||||
CT_DoLog DEBUG " Not restoring '${dir}': does not exist"
|
CT_DoLog DEBUG " Not restoring '${dir}': does not exist"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user