--- trunk/mage/usr/lib/mage/depwalker.sh 2013/10/16 06:52:01 2220 +++ trunk/mage/usr/lib/mage/depwalker.sh 2013/11/20 12:21:28 2281 @@ -27,20 +27,25 @@ echo "Usage: $(basename $0) [command] [arg] ..." echo echo " -h --help shows this help" - echo " -c --pcat categorie of the package" + echo " -c --pcat category of the package" echo " -n --pname name of the package" 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 " upgrade, srcupgrade," - echo " install-build-prerequisites, pretend-build-prerequisites" + echo " install-build-prerequisites," + echo " pretend-build-prerequisites" + echo " -d --debug enable debug mode" echo - echo "method, name, version and build must be given !" + echo "method, category, name, version and build must be given !" echo exit 1 } +# always default debug=0 +DEBUG=0 + # very basic getops for i in $* do @@ -50,6 +55,7 @@ --pver|-v) shift; PVER="$1" ;; --pbuild|-b) shift; PBUILD="$1" ;; --method|-m) shift; METHOD="$1" ;; + --debug|-d) shift; DEBUG=1 ;; --help|-h) usage ;; esac shift @@ -121,6 +127,12 @@ DFILE="$1" + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: depwalking magefile '${DFILE}'" >&2 + echo >&2 + fi + source ${DFILE} # forced nodeps @@ -179,11 +191,20 @@ if [ -z "${MY_DEPEND}" ] then + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: MY_DEPEND is empty; deps of '${DFILE}' ignored" >&2 + fi return 1 fi while read SYM DEPNAME do + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: DEPNAME='${DEPNAME}'" >&2 + fi + # exclude empty depnames [[ -z ${DEPNAME} ]] && continue @@ -224,6 +245,10 @@ then depwalking ${HIGHEST_DEPFILE} ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}" + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: added '${HIGHEST_DEPFILE}' to ALLDEPS" >&2 + fi fi fi done << EOF @@ -254,11 +279,23 @@ # get the highest mage file from mage-db MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})" + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: dep='${dep}'" >&2 + echo "DEBUG: PCAT='${PCAT}'" >&2 + echo "DEBUG: PNAME='${PNAME}'" >&2 + echo "DEBUG: MAGEFILE='${MAGEFILE}'" >&2 + fi + # if no install candidate was found, record this # and process with the next one if [[ -z ${MAGEFILE} ]] then NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}" + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: added to NO_UPGRADE_CANDIDATE" >&2 + fi continue fi @@ -266,11 +303,34 @@ PVER="$(magename2pver ${MAGEFILE})" PBUILD="$(magename2pbuild ${MAGEFILE})" + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: PVER='${PVER}'" >&2 + echo "DEBUG: PBUILD='${PBUILD}'" >&2 + fi + # do not walk files which are installed if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] then # get dependencies the package depwalking ${MAGEFILE} + + # now add the package itself to the dependencies + # (if not exists already) + if checklist_alldeps "${MAGEFILE}" + then + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: added '${MAGEFILE}' to ALLDEPS" >&2 + fi + ALLDEPS="${ALLDEPS} ${MAGEFILE}" + fi + else + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: ignored package" >&2 + echo >&2 + fi fi done else @@ -280,12 +340,20 @@ fi if [[ ${METHOD} != install-build-prerequisites ]] && - [[ ${METHOD} != pretend-build-prerequisites ]] + [[ ${METHOD} != pretend-build-prerequisites ]] && + [[ ${METHOD} != upgrade ]] && + [[ ${METHOD} != uppretend ]] && + [[ ${METHOD} != srcupgrade ]] && + [[ ${METHOD} != srcuppretend ]] then # now add the package itself to the dependencies # (if not exists already) if checklist_alldeps "${MAGEFILE}" then + if [[ ${DEBUG} = 1 ]] + then + echo "DEBUG: added '${MAGEFILE}' to ALLDEPS" >&2 + fi ALLDEPS="${ALLDEPS} ${MAGEFILE}" fi fi