pre-pkg: use existing info to check empty package

This commit is contained in:
Đoàn Trần Công Danh 2020-05-23 18:56:08 +07:00 committed by Danh Doan
parent 91c0eaa5a7
commit d9c22b4d0a
1 changed files with 8 additions and 9 deletions

View File

@ -3,6 +3,7 @@
hook() {
local error=0 filename= rev= libname= conflictPkg= conflictFile=
local conflictRev= ignore= found= mapshlibs=$XBPS_COMMONDIR/shlibs
local emptypkg=yes
set +E
@ -36,9 +37,9 @@ hook() {
msg_red "${pkgver}: File /* is not allowed\n"
error=1
fi
# Empty meta package is fine
;;
lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv)
emptypkg=no
;;
INSTALL|INSTALL.msg|REMOVE|REMOVE.msg|rdeps|shlib-requires|shlib-provides)
if [ ! -f "${PKGDESTDIR}/$f" ]; then
@ -53,6 +54,12 @@ hook() {
esac
done
# Forbid empty packages unless build_style=meta
if [ "$build_style" != meta -a "$emptypkg" != no ]; then
msg_red "${pkgver}: PKGDESTDIR is empty and build_style != meta\n"
error=1
fi
# Check that configuration files really exist.
for f in $(expand_destdir "${conf_files}"); do
if [ ! -f "${PKGDESTDIR}/${f}" ]; then
@ -114,14 +121,6 @@ hook() {
fi
done
# Forbid empty packages unless build_style=meta
if [ "$build_style" != "meta" ]; then
if [ "$(find $PKGDESTDIR/* -maxdepth 1 -type d 2>/dev/null)" = "" ]; then
msg_red "${pkgver}: PKGDESTDIR is empty and build_style != meta\n"
error=1
fi
fi
if [ $error -gt 0 ]; then
msg_error "${pkgver}: cannot continue with installation!\n"
fi