kiss: added KISS_PREFIX and friends + fixed bug in pkg_fix_deps. former related to #191

This commit is contained in:
Dylan Araps 2020-09-27 19:57:06 +03:00
parent 92ea10d562
commit e070753d7b
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

53
kiss
View File

@ -89,10 +89,10 @@ run_user_hook() {
# their own hook to override this behavior.
-post-build)
rm -rf \
"$3/usr/share/gettext" \
"$3/usr/share/polkit-1" \
"$3/usr/share/locale" \
"$3/usr/share/info"
"$3/$KISS_PREFIX/$KISS_DATADIR/gettext" \
"$3/$KISS_PREFIX/$KISS_DATADIR/polkit-1" \
"$3/$KISS_PREFIX/$KISS_DATADIR/locale" \
"$3/$KISS_PREFIX/$KISS_DATADIR/info"
;;
[!-]*)
@ -149,18 +149,18 @@ sh256() {
}
pkg_owner() {
pkg_owner=$(
set +f
set +f
[ "$3" ] ||
set -- "$1" "$2" "$sys_db/"*/manifest
[ "$3" ] ||
set -- "$1" "$2" "$sys_db"/*/manifest
grep "$@"
pkg_owner=$(grep "$@")
pkg_owner=${pkg_owner%/*}
pkg_owner=${pkg_owner##*/}
) && {
pkg_owner=${pkg_owner%/*}
pkg_owner=${pkg_owner##*/}
}
set -f
[ "$pkg_owner" ]
}
pkg_lint() {
@ -505,11 +505,12 @@ pkg_fix_deps() {
;;
*)
pkg_owner -l "/${line#/}\$" manifest ||
! pkg_owner -l "/${line#/}\$" "$@" &&
# Skip file if owned by current package
pkg_owner -l "/${line#/}\$" "$PWD/manifest" &&
continue
printf '%s\n' "$pkg_owner"
pkg_owner -l "/${line#/}\$" "$@" &&
printf '%s\n' "$pkg_owner"
;;
esac
;;
@ -523,7 +524,11 @@ pkg_fix_deps() {
mv -f "$tmp_dir/.fixdeps" depends
[ -s depends ] || rm -f depends
if [ -s depends ]; then
pkg_manifest "${PWD##*/}"
else
rm -f depends
fi
}
pkg_manifest() (
@ -693,10 +698,13 @@ pkg_build() {
# Remove all .la files from the packages. They're unneeded and cause
# issues when a package stops providing one. This recently caused an
# issue with harfbuzz (See: 05096e5a4dc6db5d202342f538d067d87ae7135e).
find "$pkg_dir/$pkg/usr/lib" -name \*.la -exec rm -f {} + 2>/dev/null ||:
find "$pkg_dir/$pkg/$KISS_PREFIX/$KISS_LIBDIR" \
-name \*.la \
-exec rm -f {} + \
2>/dev/null ||:
# Endless source of conflicts.
rm -f "$pkg_dir/$pkg/usr/lib/charset.alias"
rm -f "$pkg_dir/$pkg/$KISS_PREFIX/$KISS_LIBDIR/charset.alias"
# Create the manifest file early and make it empty. This ensures that
# the manifest is added to the manifest.
@ -707,8 +715,8 @@ pkg_build() {
: > "$pkg_dir/$pkg/$pkg_db/$pkg/etcsums"
pkg_strip "$pkg"
pkg_fix_deps "$pkg"
pkg_manifest "$pkg"
pkg_fix_deps "$pkg"
pkg_etcsums "$pkg"
pkg_tar "$pkg"
@ -1497,6 +1505,11 @@ main() {
# Globally disable globbing and enable exit-on-error.
set -ef
# Set the default values of system directories.
export KISS_PREFIX=${KISS_PREFIX:-/usr}
export KISS_LIBDIR=${KISS_LIBDIR:-/lib}
export KISS_DATADIR=${KISS_DATADIR:-/share}
# Allow the user to disable colors in output via an environment variable.
# Check this once so as to not slow down printing.
[ "$KISS_COLOR" = 0 ] || {