--- trunk/mage/usr/lib/mage/depwalker.sh 2014/01/06 14:35:29 2376 +++ branches/mage-next/src/depwalker.in 2014/09/17 11:20:37 2829 @@ -1,13 +1,17 @@ #!/bin/bash # $Id$ -# dependeny walker +# dependency walker -# default die function -die() -{ - echo ${COLRED}"$@"${COLDEFAULT} - exit 1 -} +# set default variables +: ${MAGERC="@@SYSCONFDIR@@/mage.rc"} +: ${MLIBDIR="@@MAGELIBDIR@@"} + +# first of all include common functions +source ${MLIBDIR}/common.functions.sh || exit 1 +source @@SYSCONFDIR@@/mage.rc.global || die "@@SYSCONFDIR@@/mage.rc.global missing" +source ${MAGERC} || die "Your ${MAGERC} is missing. Aborting." +source ${MLIBDIR}/mage4.functions.sh || die "mage functions missing" +source ${MLIBDIR}/smage2.functions.sh || die "smage functions missing" decho() { @@ -17,22 +21,6 @@ fi } -# include all needed files -[ -f /etc/mage.rc.global ] && \ - source /etc/mage.rc.global || \ - die "/etc/mage.rc.global missing" - -[ -f ${MAGERC} ] && source ${MAGERC} || \ - die "Your ${MAGERC} is missing. Aborting." - -[ -f ${MLIBDIR}/mage4.functions.sh ] && \ - source ${MLIBDIR}/mage4.functions.sh || \ - die "mage functions missing" - -[ -f ${MLIBDIR}/smage2.functions.sh ] && \ - source ${MLIBDIR}/smage2.functions.sh || \ - die "smage functions missing" - usage() { echo @@ -215,7 +203,7 @@ # mark depfile as processed to prevent double runs -without version # but do not add any virtuals to PROCESSEDDEPS or their resolved - # pkgnames will be ignored and they are missing on the dependecy-list + # pkgnames will be ignored and they are missing on the dependency-list if [[ ${DEPNAME/virtual\//} = ${DEPNAME} ]] then PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}" @@ -242,6 +230,7 @@ ### check if the dependency is already installed ### if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] then + # but first get all deps of highest_depfile to catch all dependencies of it depwalking ${HIGHEST_DEPFILE} ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}" decho "added '${HIGHEST_DEPFILE}' to ALLDEPS"