1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-11-04 14:05:41 -07:00

kiss-export: Remove utility

This utility must be rewritten (with added complexity). There is
no portable way to tell tar to add a directory but not include its
contents (unless it is empty).

The simple approach of giving tar the package's manifest is not
workable without omitting directories. This causes issues when
installing an exported tarball and target directories do not exist.

The most obvious solution is to copy all of the package's files
to a temporary directory and then pass that to tar. This would
work fine but slow the process down substantially.

Another solution will be sought and if not possible the above will
be implemented instead.

Closes #254
This commit is contained in:
Dylan Araps 2021-08-02 17:29:08 +03:00
parent 26ca4b0747
commit 66958b3232
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

View File

@ -1,33 +0,0 @@
#!/bin/sh -ef
# Turn an installed package into a KISS tarball
db=$KISS_ROOT/var/db/kiss/installed
pkg=${1:-"${PWD##*/}"}
kiss list "$pkg" >/dev/null || {
printf 'usage: kiss-export [pkg]\n'
exit 1
}
read -r ver rel 2>/dev/null < "$db/$1/version"
set --
while read -r file; do
[ -d "$KISS_ROOT/$file" ] || set -- "$@" ".$file"
done < "$db/$pkg/manifest"
cd "$KISS_ROOT/"
dest="$OLDPWD/$pkg@$ver-$rel.tar.${KISS_COMPRESS:-gz}"
tar cf - "$@" | case ${KISS_COMPRESS:-gz} in
bz2) bzip2 -z ;;
gz) gzip -6 ;;
lzma) lzma -z ;;
lz) lzip -z ;;
xz) xz -zT 0 ;;
zst) zstd -z ;;
esac > "$dest"
printf 'created %s\n' "$dest"