#!/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() { ${PKG_INFO} -E "$1" || ${TRUE} } ${CAT} ${DEPENDS_FILE} | while read type pattern dir; do pkg=`find_best "$pattern"` 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