forked from kiss-community/kiss
kiss: improve compression (#110)
move compression to its own function use threads for (de)compression where possible drop some useless flags Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/110 Reviewed-by: phoebos <phoebos@noreply.codeberg.org> Co-authored-by: illiliti <illiliti@protonmail.com> Co-committed-by: illiliti <illiliti@protonmail.com>
This commit is contained in:
parent
ed4b6b7534
commit
b04a707130
34
kiss
34
kiss
@ -192,15 +192,26 @@ run_hook_pkg() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compress() {
|
||||||
|
case $KISS_COMPRESS in
|
||||||
|
bz2) bzip2 -c ;;
|
||||||
|
gz) gzip -c ;;
|
||||||
|
lz) lzip -c ;;
|
||||||
|
lzma) lzma -cT0 ;;
|
||||||
|
xz) xz -cT0 ;;
|
||||||
|
zst) zstd -cT0 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
decompress() {
|
decompress() {
|
||||||
case $1 in
|
case $1 in
|
||||||
*.tbz|*.bz2) bzip2 -d ;;
|
*.tar) cat ;;
|
||||||
*.lzma) lzma -dc ;;
|
*.tbz|*.bz2) bzip2 -dc ;;
|
||||||
*.lz) lzip -dc ;;
|
*.lz) lzip -dc ;;
|
||||||
*.tar) cat ;;
|
*.tgz|*.gz) gzip -dc ;;
|
||||||
*.tgz|*.gz) gzip -d ;;
|
*.lzma) lzma -dcT0 ;;
|
||||||
*.xz|*.txz) xz -dc ;;
|
*.xz|*.txz) xz -dcT0 ;;
|
||||||
*.zst) zstd -dc ;;
|
*.zst) zstd -dcT0 ;;
|
||||||
esac < "$1"
|
esac < "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,14 +986,7 @@ pkg_tar() {
|
|||||||
cd "$pkg_dir/$1"
|
cd "$pkg_dir/$1"
|
||||||
|
|
||||||
# Create a tarball from the contents of the built package.
|
# Create a tarball from the contents of the built package.
|
||||||
tar cf - . | case $KISS_COMPRESS in
|
tar cf - . | compress > "$_tar_file"
|
||||||
bz2) bzip2 -z ;;
|
|
||||||
gz) gzip -6 ;;
|
|
||||||
lzma) lzma -z ;;
|
|
||||||
lz) lzip -z ;;
|
|
||||||
xz) xz -z ;;
|
|
||||||
zst) zstd -z ;;
|
|
||||||
esac > "$_tar_file"
|
|
||||||
|
|
||||||
cd "$OLDPWD"
|
cd "$OLDPWD"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user