xbps-src: detect two types of build loops and abort()

- depends on itself
- dep depends on targetpkg
This commit is contained in:
Juan RP 2019-04-15 12:38:36 +02:00 committed by maxice8
parent 13901bc715
commit 35a8e8c6b6
1 changed files with 23 additions and 2 deletions

View File

@ -217,13 +217,13 @@ install_pkg_deps() {
# Host build dependencies.
#
for i in ${host_build_depends}; do
_realpkg=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null)
check_pkgdep_matched "$i" version
local rval=$?
if [ $rval -eq 0 ]; then
echo " [host] ${i}: installed."
continue
elif [ $rval -eq 1 ]; then
_realpkg="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
iver=$($XBPS_UHELPER_CMD version ${_realpkg})
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [host] ${i}: installed $iver (virtualpkg)."
@ -240,6 +240,11 @@ install_pkg_deps() {
continue
else
echo " [host] ${i}: not found."
if [ "${_realpkg}" = "$targetpkg" ]; then
msg_error "${pkg}: [host] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]\n"
elif [ "${_realpkg}" = "$pkg" ]; then
msg_error "${pkg}: [host] build loop detected: $pkg <-> ${_realpkg}\n"
fi
fi
fi
host_missing_deps+=("${i}")
@ -249,13 +254,13 @@ install_pkg_deps() {
# Host check dependencies.
#
for i in ${host_check_depends}; do
_realpkg="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
check_pkgdep_matched "$i" version
local rval=$?
if [ $rval -eq 0 ]; then
echo " [check] ${i}: installed."
continue
elif [ $rval -eq 1 ]; then
_realpkg="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
iver=$($XBPS_UHELPER_CMD version ${_realpkg})
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [check] ${i}: installed $iver (virtualpkg)."
@ -272,6 +277,11 @@ install_pkg_deps() {
continue
else
echo " [check] ${i}: not found."
if [ "${_realpkg}" = "$targetpkg" ]; then
msg_error "${pkg}: [check] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]!\n"
elif [ "${_realpkg}" = "$pkg" ]; then
msg_error "${pkg}: [check] build loop detected: $pkg <-> ${_realpkg}\n"
fi
fi
fi
check_missing_deps+=("${i}")
@ -311,6 +321,11 @@ install_pkg_deps() {
continue
else
echo " [target] ${i}: not found."
if [ "${_realpkg}" = "$targetpkg" ]; then
msg_error "${pkg}: [target] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]\n"
elif [ "${_realpkg}" = "$pkg" ]; then
msg_error "${pkg}: [target] build loop detected: $pkg <-> ${_realpkg}\n"
fi
fi
fi
missing_deps+=("${i}")
@ -368,6 +383,11 @@ install_pkg_deps() {
echo " [runtime] ${_realpkg}: not found."
fi
fi
if [ "${_realpkg}" = "$targetpkg" ]; then
msg_error "${pkg}: [run] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]\n"
elif [ "${_realpkg}" = "$pkg" ]; then
msg_error "${pkg}: [run] build loop detected: $pkg <-> ${_realpkg}\n"
fi
missing_rdeps+=("${_realpkg}")
done
@ -414,6 +434,7 @@ install_pkg_deps() {
for i in ${missing_deps[@]}; do
# packages not found in repos, install from source.
(
curpkgdepname=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null)
setup_pkg $curpkgdepname $cross
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \