kiss: simplify

This commit is contained in:
Dylan Araps 2020-03-23 13:04:45 +02:00
parent d4d01a5512
commit c84472e531
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 9 additions and 13 deletions

22
kiss
View File

@ -474,14 +474,12 @@ pkg_tar() {
read -r version release < "$(pkg_find "$1")/version" read -r version release < "$(pkg_find "$1")/version"
# Create a tar-ball from the contents of the built package. # Create a tar-ball from the contents of the built package.
"$tar" cf - -C "$pkg_dir/$1" . | "$tar" cf - -C "$pkg_dir/$1" . | case ${KISS_COMPRESS:=gz} in
case ${KISS_COMPRESS:=gz} in bz2) bzip2 -z ;;
bz2) bzip2 -z ;; gz) gzip -6 ;;
xz) xz -zT 0 ;; xz) xz -zT 0 ;;
gz) gzip -6 ;; zst) zstd -z ;;
zst) zstd -z ;; esac > "$bin_dir/$1#$version-$release.tar.${KISS_COMPRESS:=gz}"
esac \
> "$bin_dir/$1#$version-$release.tar.${KISS_COMPRESS:=gz}"
log "$1" "Successfully created tar-ball" log "$1" "Successfully created tar-ball"
} }
@ -634,16 +632,14 @@ pkg_build() {
pkg_checksums() { pkg_checksums() {
# Generate checksums for packages. # Generate checksums for packages.
repo_dir=$(pkg_find "$1")
while read -r src _ || [ "$src" ]; do while read -r src _ || [ "$src" ]; do
# Comment. # Comment.
if [ -z "${src##\#*}" ]; then if [ -z "${src##\#*}" ]; then
continue continue
# File is local to the package. # File is local to the package.
elif [ -f "$repo_dir/$src" ]; then elif [ -f "$(pkg_find "$1")/$src" ]; then
src_path=$repo_dir/${src%/*} src_path=$(pkg_find "$1")/${src%/*}
# File is remote and was downloaded. # File is remote and was downloaded.
elif [ -f "$src_dir/$1/${src##*/}" ]; then elif [ -f "$src_dir/$1/${src##*/}" ]; then
@ -663,7 +659,7 @@ pkg_checksums() {
# of files is to 'cd' to the file's directory beforehand. # of files is to 'cd' to the file's directory beforehand.
(cd "$src_path" && sha256sum "${src##*/}") || (cd "$src_path" && sha256sum "${src##*/}") ||
die "$1" "Failed to generate checksums" die "$1" "Failed to generate checksums"
done < "$repo_dir/sources" done < "$(pkg_find "$1")/sources"
} }
pkg_verify() { pkg_verify() {