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

View file

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