--- trunk/mage/usr/lib/mage/depwalker.sh 2014/01/06 12:35:42 2359 +++ branches/mage-next/src/depwalker.in 2014/01/29 12:27:04 2573 @@ -29,6 +29,10 @@ 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 @@ -45,6 +49,7 @@ echo " install-build-prerequisites," echo " pretend-build-prerequisites" echo " -d --debug enable debug mode" + echo " -s --smage use a smage to calculate dependencies" echo echo "method, category, name, version and build must be given !" echo @@ -64,16 +69,20 @@ --pbuild|-b) shift; PBUILD="$1" ;; --method|-m) shift; METHOD="$1" ;; --debug|-d) shift; DEBUG=1 ;; + --smage|-s) shift; SMAGEFILE="$1"; SILENT=1; FVERBOSE=off ;; --help|-h) usage ;; esac shift done # sanity checks; abort if not given -[ -z "${PCAT}" ] && usage -[ -z "${PNAME}" ] && usage -[ -z "${PVER}" ] && usage -[ -z "${PBUILD}" ] && usage +if [[ -z ${SMAGEFILE} ]] +then + [ -z "${PCAT}" ] && usage + [ -z "${PNAME}" ] && usage + [ -z "${PVER}" ] && usage + [ -z "${PBUILD}" ] && usage +fi [ -z "${METHOD}" ] && usage # check needed global vars @@ -83,6 +92,15 @@ # other needed vars ALLDEPS="" +if [[ -n ${SMAGEFILE} ]] +then + if [[ -e ${SMAGEFILE} ]] + then + smagesource "${SMAGEFILE}" + else + die "Smage file '${SMAGEFILE}' does not exist!" + fi +fi MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage" # much faster than fgrep @@ -294,16 +312,19 @@ ALLDEPS="${ALLDEPS} ${MAGEFILE}" fi else - # debug info - decho "ignored package" - decho - fi + # debug info + decho "ignored package" + decho fi done else - LOOP_COUNTER=0 # get all dependencies of the package - depwalking ${MAGEFILE} + if [[ -n ${SMAGEFILE} ]] + then + depwalking "${SMAGEFILE}" + else + depwalking "${MAGEFILE}" + fi fi if [[ ${METHOD} != install-build-prerequisites ]] &&