2014-03-19 15:32:12 +00:00
|
|
|
# This hook checks for common issues related to void.
|
|
|
|
|
|
|
|
hook() {
|
2014-03-24 10:15:29 +00:00
|
|
|
local error=0 filename= rev= libname= conflictPkg= conflictFile=
|
2014-09-10 11:04:46 +00:00
|
|
|
local conflictRev= ignore= found= mapshlibs=$XBPS_COMMONDIR/shlibs
|
2014-03-19 15:32:12 +00:00
|
|
|
|
2014-03-27 12:57:17 +00:00
|
|
|
set +E
|
|
|
|
|
2015-04-05 16:41:01 +00:00
|
|
|
# Check for forbidden directories that are symlinks in void.
|
2014-03-19 15:32:12 +00:00
|
|
|
for f in bin sbin lib lib32; do
|
|
|
|
if [ -d ${PKGDESTDIR}/${f} ]; then
|
|
|
|
msg_red "${pkgver}: /${f} directory is not allowed, use /usr/${f}.\n"
|
|
|
|
error=1
|
|
|
|
fi
|
|
|
|
done
|
2015-06-03 12:13:31 +00:00
|
|
|
if [ -d ${PKGDESTDIR}/usr/sbin ]; then
|
|
|
|
msg_red "${pkgver}: /usr/sbin directory is not allowed, use /usr/bin.\n"
|
|
|
|
error=1
|
|
|
|
fi
|
2014-03-19 15:32:12 +00:00
|
|
|
for f in sys dev home root run var/run tmp usr/lib64 usr/local; do
|
|
|
|
if [ -d ${PKGDESTDIR}/${f} ]; then
|
|
|
|
msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
|
|
|
|
error=1
|
|
|
|
fi
|
|
|
|
done
|
2015-04-05 16:41:01 +00:00
|
|
|
|
|
|
|
# Check that configuration files really exist.
|
2015-11-18 10:19:09 +00:00
|
|
|
for f in $(expand_destdir "${conf_files}"); do
|
2015-11-18 08:44:34 +00:00
|
|
|
if [ ! -f "${PKGDESTDIR}/${f}" ]; then
|
2015-04-05 16:41:01 +00:00
|
|
|
msg_red "${pkgver}: '$f' configuration file not in PKGDESTDIR!\n"
|
|
|
|
error=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2015-11-13 12:05:36 +00:00
|
|
|
# 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
|
|
|
|
|
2014-03-19 15:32:12 +00:00
|
|
|
if [ $error -gt 0 ]; then
|
|
|
|
msg_error "${pkgver}: cannot continue with installation!\n"
|
|
|
|
fi
|
2014-03-24 10:15:29 +00:00
|
|
|
|
|
|
|
# Check for missing shlibs and SONAME bumps.
|
2015-11-13 12:05:36 +00:00
|
|
|
if [ ! -s "${PKGDESTDIR}/shlib-provides" ]; then
|
2014-03-24 10:15:29 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2015-11-13 12:05:36 +00:00
|
|
|
for filename in $(cat ${PKGDESTDIR}/shlib-provides); do
|
2014-03-24 10:15:29 +00:00
|
|
|
rev=${filename#*.so.}
|
|
|
|
libname=${filename%.so*}
|
2014-04-04 15:24:47 +00:00
|
|
|
_shlib=$(echo "$libname"|sed -E 's|\+|\\+|g')
|
2014-03-27 12:57:17 +00:00
|
|
|
_pkgname=$(echo "$pkgname"|sed -E 's|\+|\\+|g')
|
2014-04-09 06:55:43 +00:00
|
|
|
if [ "$rev" = "$filename" ]; then
|
2014-09-10 11:04:46 +00:00
|
|
|
_pattern="^${_shlib}\.so[[:blank:]]+${_pkgname}-[^-]+_[0-9]+"
|
2014-04-09 06:55:43 +00:00
|
|
|
else
|
2014-09-10 11:04:46 +00:00
|
|
|
_pattern="^${_shlib}\.so\.[0-9]+(.*)[[:blank:]]+${_pkgname}-[^-]+_[0-9]+"
|
2014-04-09 06:55:43 +00:00
|
|
|
fi
|
|
|
|
grep -E "${_pattern}" $mapshlibs | { \
|
2014-09-10 11:04:46 +00:00
|
|
|
while read conflictFile conflictPkg ignore; do
|
2014-03-24 10:15:29 +00:00
|
|
|
found=1
|
|
|
|
conflictRev=${conflictFile#*.so.}
|
2014-09-10 11:04:46 +00:00
|
|
|
if [ -n "$ignore" -a "$ignore" != "$XBPS_TARGET_MACHINE" ]; then
|
|
|
|
continue
|
|
|
|
elif [ "$rev" = "$conflictRev" ]; then
|
2014-03-24 10:15:29 +00:00
|
|
|
continue
|
2014-03-31 16:14:52 +00:00
|
|
|
elif [[ ${rev}.* =~ $conflictRev ]]; then
|
2014-03-24 10:15:29 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
msg_red "${pkgver}: SONAME bump detected: ${libname}.so.${conflictRev} -> ${libname}.so.${rev}\n"
|
|
|
|
msg_red "${pkgver}: please update common/shlibs with this line: \"${libname}.so.${rev} ${pkgver}\"\n"
|
|
|
|
msg_red "${pkgver}: all reverse dependencies should also be revbumped to be rebuilt against ${libname}.so.${rev}:\n"
|
2014-12-10 08:32:28 +00:00
|
|
|
_revdeps=$($XBPS_QUERY_XCMD -Rs ${libname}.so -p shlib-requires|awk '{print $1}')
|
2014-04-04 15:24:47 +00:00
|
|
|
for x in ${_revdeps}; do
|
|
|
|
msg_red " ${x%:}\n"
|
2014-03-24 10:15:29 +00:00
|
|
|
done
|
|
|
|
msg_error "${pkgver}: cannot continue with installation!\n"
|
|
|
|
done
|
2014-03-27 12:57:17 +00:00
|
|
|
# Try to match provided shlibs in virtual packages.
|
|
|
|
for f in ${provides}; do
|
|
|
|
_vpkgname="$($XBPS_UHELPER_CMD getpkgname ${f} 2>/dev/null)"
|
|
|
|
_spkgname="$(grep "^${filename}" $mapshlibs | awk '{print $2}')"
|
|
|
|
_libpkgname="$($XBPS_UHELPER_CMD getpkgname ${_spkgname} 2>/dev/null)"
|
|
|
|
if [ -z "${_spkgname}" -o -z "${_libpkgname}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if [ "${_vpkgname}" = "${_libpkgname}" ]; then
|
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done;
|
2014-03-24 10:15:29 +00:00
|
|
|
if [ -z "$found" ]; then
|
2014-05-09 07:22:03 +00:00
|
|
|
_myshlib="${libname}.so"
|
|
|
|
[ "${_myshlib}" != "${rev}" ] && _myshlib+=".${rev}"
|
|
|
|
msg_warn "${pkgver}: ${_myshlib} not found in common/shlibs!\n"
|
2014-03-24 10:15:29 +00:00
|
|
|
fi;
|
|
|
|
}
|
|
|
|
done
|
2014-03-19 15:32:12 +00:00
|
|
|
}
|