Fix compression of package databases with zstd

Commit 7afe51171 attempted to add zstd compression support to repo-add,
but failed...

FS#64213

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Nick Cao 2019-10-22 17:27:15 +10:00 committed by Allan McRae
parent 942b909829
commit 7df70e7fff

View file

@ -193,11 +193,11 @@ verify_repo_extension() {
local repofile=$1 local repofile=$1
case $repofile in case $repofile in
*.db.tar.gz) TAR_OPT="z" ;; *.db.tar.gz) TAR_OPT="-z" ;;
*.db.tar.bz2) TAR_OPT="j" ;; *.db.tar.bz2) TAR_OPT="-j" ;;
*.db.tar.xz) TAR_OPT="J" ;; *.db.tar.xz) TAR_OPT="-J" ;;
*.db.tar.zst) TAR_OPT="--zstd" ;; *.db.tar.zst) TAR_OPT="--zstd" ;;
*.db.tar.Z) TAR_OPT="Z" ;; *.db.tar.Z) TAR_OPT="-Z" ;;
*.db.tar) TAR_OPT="" ;; *.db.tar) TAR_OPT="" ;;
*) error "$(gettext "'%s' does not have a valid database archive extension.")" \ *) error "$(gettext "'%s' does not have a valid database archive extension.")" \
"$repofile" "$repofile"
@ -534,11 +534,11 @@ create_db() {
pushd "$tmpdir/$repo" >/dev/null pushd "$tmpdir/$repo" >/dev/null
if ( shopt -s nullglob; files=(*); (( ${#files[*]} )) ); then if ( shopt -s nullglob; files=(*); (( ${#files[*]} )) ); then
bsdtar -c${TAR_OPT}f "$tempname" * bsdtar -c ${TAR_OPT} -f "$tempname" *
else else
# we have no packages remaining? zip up some emptyness # we have no packages remaining? zip up some emptyness
warning "$(gettext "No packages remain, creating empty database.")" warning "$(gettext "No packages remain, creating empty database.")"
bsdtar -c${TAR_OPT}f "$tempname" -T /dev/null bsdtar -c ${TAR_OPT} -f "$tempname" -T /dev/null
fi fi
popd >/dev/null popd >/dev/null