--- branches/mage-next/src/mage4.functions.sh.in 2014/09/03 11:58:06 2810 +++ branches/mage-next/src/mage4.functions.sh.in 2014/09/03 12:01:21 2811 @@ -1713,71 +1713,17 @@ echo "${categorie}" } -# check_stable_package /path/to/foo.mage -# returns 0=stable 1=unstable -check_stable_package() -{ - # first check if this magefile is not blacklisted - blacklisted "$1" || return 1 - - local STATE - STATE="$(get_value_from_magefile STATE "$1")" - - # state testing - if [[ ${USE_TESTING} = true ]] || [[ ${MAGE_DISTRIBUTION} = testing ]] - then - case ${STATE} in - testing|stable) return 0 ;; - *) return 1 ;; - esac - fi - - # state unstable - if [[ ${USE_UNSTABLE} = true ]] || [[ ${MAGE_DISTRIBUTION} = unstable ]] - then - case ${STATE} in - unstable|testing|stable) return 0 ;; - *) return 1 ;; - esac - fi - - # no use_state given = stable - case ${STATE} in - stable) return 0 ;; - *) return 1 ;; - esac -} - - # get_highest_magefile ${PCAT} ${PNAME} -# fake at moment returns only stable pkgs (must set to be one) -# return $HIGHEST_MAGEFILE +# returns $HIGHEST_MAGEFILE get_highest_magefile() { - local HIGHEST_MAGEFILE - local PCAT="$1" - local PNAME="$2" - local magefile + local pcat="$1" + local pname="$2" - # do not list the content of a directory, only the name (-d) - for magefile in $(ls --format=single-column -v -d ${MAGEDIR}/${PCAT}/${PNAME}/* 2> /dev/null) - do - [[ -z ${magefile} ]] && continue - # we exclude subdirs (for stuff like a md5sum dir) - [[ -d ${magefile} ]] && continue - if check_stable_package ${magefile} - then - HIGHEST_MAGEFILE=${magefile} - #for debug only - mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" >&2 - fi - done - - echo "${HIGHEST_MAGEFILE}" + ${MLIBDIR}/highest_magefile ${MAGEDIR}/${pcat}/${pname} return 0 } - ################################################### # function is_config_protected # # is_config_protected /path/to/file #