--- trunk/mage/usr/lib/mage/depwalker.sh 2013/12/02 10:11:10 2285 +++ branches/mage-next/src/depwalker.sh 2014/01/29 12:08:29 2553 @@ -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 @@ -40,11 +44,12 @@ echo " -v --pver version number of the package" echo " -b --pbuild build number of the package" echo " -m --method which calc method should be used:" - echo " install, srcinstall, depend, srcdepend" + echo " install, srcinstall, pretend, srcpretend" echo " upgrade, srcupgrade," 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 @@ -151,10 +169,12 @@ MY_DEPEND="${DEPEND}" # for srcinstall & srcdepend only; SDEPEND also needed - if [[ ${METHOD} = srcinstall ]] || \ - [[ ${METHOD} = srcpretend ]] || \ - [[ ${METHOD} = srcupgrade ]] || \ - [[ ${METHOD} = srcuppretend ]] + if [[ ${METHOD} = srcinstall ]] || + [[ ${METHOD} = srcpretend ]] || + [[ ${METHOD} = srcupgrade ]] || + [[ ${METHOD} = srcuppretend ]] || + [[ ${METHOD} = install-build-prerequisites ]] || + [[ ${METHOD} = pretend-build-prerequisites ]] then # only if SDEPEND is not zero if [ -n "${SDEPEND}" ] @@ -170,28 +190,6 @@ fi fi - if [[ ${METHOD} = install-build-prerequisites ]] || \ - [[ ${METHOD} = pretend-build-prerequisites ]] - then - # only one time - if [[ ${LOOP_COUNTER} -lt 1 ]] - then - # only if SDEPEND is not zero - if [ -n "${SDEPEND}" ] - then - # crlf is substantly needed !! - if [ -n "${MY_DEPEND}" ] - then - MY_DEPEND="${MY_DEPEND} - ${SDEPEND}" - else - MY_DEPEND="${SDEPEND}" - fi - fi - fi - LOOP_COUNTER=${LOOP_COUNTER}+1 - fi - unset DEPEND unset SDEPEND @@ -314,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 ]] &&