Changeset View
Changeset View
Standalone View
Standalone View
Mk/Scripts/do-depends.sh
Show All 15 Lines | |||||
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_DEPENDS}" ] && set -x | [ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_DEPENDS}" ] && set -x | ||||
set -u | set -u | ||||
install_depends() | install_depends() | ||||
{ | { | ||||
origin=$1 | origin=$1 | ||||
target=$2 | target=$2 | ||||
depends_args=$3 | subpkg=$3 | ||||
depends_args=$4 | |||||
if [ -z "${dp_USE_PACKAGE_DEPENDS}" -a -z "${dp_USE_PACKAGE_DEPENDS_ONLY}" ]; then | if [ -z "${dp_USE_PACKAGE_DEPENDS}" -a -z "${dp_USE_PACKAGE_DEPENDS_ONLY}" ]; then | ||||
MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} | MAKEFLAGS="${dp_MAKEFLAGS}" ${dp_MAKE} -C ${origin} -DINSTALLS_DEPENDS ${target} ${depends_args} | ||||
return 0 | return 0 | ||||
fi | fi | ||||
if [ -z "${subpkg}" ]; then | |||||
port_var_fetch "${origin}" "${depends_args}" \ | port_var_fetch "${origin}" "${depends_args}" \ | ||||
PKGFILE pkgfile \ | PKGFILE pkgfile \ | ||||
PKGBASE pkgbase | PKGBASE pkgbase | ||||
else | |||||
port_var_fetch "${origin}" "${depends_args}" \ | |||||
PKGFILE.${subpkg} pkgfile \ | |||||
PKGBASE.${subpkg} pkgbase | |||||
fi | |||||
if [ -r "${pkgfile}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then | if [ -r "${pkgfile}" -a "${target}" = "${dp_DEPENDS_TARGET}" ]; then | ||||
echo "===> Installing existing package ${pkgfile}" | echo "===> Installing existing package ${pkgfile}" | ||||
if [ "${pkgbase}" = "pkg" ]; then | if [ "${pkgbase}" = "pkg" ]; then | ||||
[ -d ${dp_WRKDIR} ] || mkdir -p ${dp_WRKDIR} | [ -d ${dp_WRKDIR} ] || mkdir -p ${dp_WRKDIR} | ||||
tar xf ${pkgfile} -C ${dp_WRKDIR} -s ",/.*/,,g" "*/pkg-static" | tar xf ${pkgfile} -C ${dp_WRKDIR} -s ",/.*/,,g" "*/pkg-static" | ||||
${dp_WRKDIR}/pkg-static add ${pkgfile} | ${dp_WRKDIR}/pkg-static add ${pkgfile} | ||||
rm -f ${dp_WRKDIR}/pkg-static | rm -f ${dp_WRKDIR}/pkg-static | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | for _line in ${dp_RAWDEPENDS} ; do | ||||
fi | fi | ||||
if [ -z "${origin}" ]; then | if [ -z "${origin}" ]; then | ||||
echo "Error: a dependency has an empty origin in ${dp_DEPTYPE}" >&2 | echo "Error: a dependency has an empty origin in ${dp_DEPTYPE}" >&2 | ||||
err=1 | err=1 | ||||
continue | continue | ||||
fi | fi | ||||
subpkg= | |||||
case "${origin}" in | case "${origin}" in | ||||
*@*/*) ;; # Ignore @ in the path which would not be a flavor | *@*/*) ;; # Ignore @ in the path which would not be a flavor | ||||
*@*) | *@*) | ||||
export FLAVOR="${origin##*@}" | export FLAVOR="${origin##*@}" | ||||
origin=${origin%@*} | origin=${origin%@*} | ||||
;; | ;; | ||||
*~*/*) ;; # Ignore ~ in the path which would not be a subpackage | |||||
*~*) | |||||
subpkg="${origin##*~}" | |||||
origin=${origin%~*} | |||||
;; | |||||
esac | esac | ||||
case "${origin}" in | case "${origin}" in | ||||
/*) ;; | /*) ;; | ||||
*) | *) | ||||
for overlay in ${dp_OVERLAYS} ${PORTSDIR}; do | for overlay in ${dp_OVERLAYS} ${PORTSDIR}; do | ||||
orig="${overlay}/${origin}" | orig="${overlay}/${origin}" | ||||
if [ -f "${orig}/Makefile" ]; then | if [ -f "${orig}/Makefile" ]; then | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | for _line in ${dp_RAWDEPENDS} ; do | ||||
if [ ! -f "${origin}/Makefile" ]; then | if [ ! -f "${origin}/Makefile" ]; then | ||||
echo "Error a dependency refers to a non existing origin: ${origin} in ${dp_DEPTYPE}" >&2 | echo "Error a dependency refers to a non existing origin: ${origin} in ${dp_DEPTYPE}" >&2 | ||||
err=1 | err=1 | ||||
continue | continue | ||||
fi | fi | ||||
# Now actually install the dependencies | # Now actually install the dependencies | ||||
install_depends "${origin}" "${target}" "${depends_args}" | install_depends "${origin}" "${target}" "${subpkg}" "${depends_args}" | ||||
# Recheck if the installed dependency validates the pattern except for /nonexistent | # Recheck if the installed dependency validates the pattern except for /nonexistent | ||||
[ "${fct}" = "false" ] || ${fct} "${pattern}" | [ "${fct}" = "false" ] || ${fct} "${pattern}" | ||||
echo "===> Returning to build of ${dp_PKGNAME}" | echo "===> Returning to build of ${dp_PKGNAME}" | ||||
done | done | ||||
if [ $err -eq 1 ]; then | if [ $err -eq 1 ]; then | ||||
echo "Errors with dependencies." | echo "Errors with dependencies." | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
if [ -n "${dp_STRICT_DEPENDS}" -a ${anynotfound} -eq 1 ]; then \ | if [ -n "${dp_STRICT_DEPENDS}" -a ${anynotfound} -eq 1 ]; then \ | ||||
echo "===> STRICT_DEPENDS set - Not installing missing dependencies." | echo "===> STRICT_DEPENDS set - Not installing missing dependencies." | ||||
echo " This means a dependency is wrong since it was not satisfied in the ${dp_DEPTYPE} phase." | echo " This means a dependency is wrong since it was not satisfied in the ${dp_DEPTYPE} phase." | ||||
exit 1 | exit 1 | ||||
fi | fi |