--- trunk/mage/usr/lib/mage/depwalker.sh 2013/12/02 10:12:35 2286 +++ branches/mage-next/src/depwalker.in 2014/03/05 08:15:28 2625 @@ -18,16 +18,10 @@ } # 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" +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" usage() { @@ -40,11 +34,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 +59,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 +82,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 +302,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 ]] &&