#!/bin/sh # ###################################################################### # # NAME # resolve-dependencies -- resolve package dependencies # # SYNOPSIS # resolve-dependencies # # DESCRIPTION # resolve-dependencies checks all entries in ${DEPENDS_FILE} # for existance. The best matching pattern is printed similiar # to list-dependencies # ###################################################################### : ${CAT:=cat} : ${ECHO:=echo} : ${TEST:=test} : ${TRUE:=true} set -e DEPENDS_FILE=${_DEPENDS_FILE} unset _DEPENDS_FILE error_msg() { ${ECHO} "ERROR:" "$*" 1>&2 } find_best() { case $1 in bootstrap|tool) ${HOST_PKG_INFO} -E "$2" || ${TRUE};; build|full) ${PKG_INFO} -E "$2" || ${TRUE};; esac } ${CAT} ${DEPENDS_FILE} | while read type pattern dir; do pkg=`find_best "$type" "$pattern"` [ "$type" != test ] || continue case "$pkg" in "") error_msg "[resolve-dependencies] A package matching \`\`$pattern'' should" error_msg " be installed, but one cannot be found. Perhaps there is a" error_msg " stale work directory for $dir?" exit 1 ;; *) ${ECHO} "$type $pattern $pkg" ;; esac done