--- trunk/mage/usr/lib/mage/mage4.functions.sh 2012/01/03 16:17:48 1603 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2012/01/13 23:17:40 1653 @@ -66,7 +66,7 @@ case ${method} in md5) cmd="md5sum" ;; sha256) cmd="sha256sum" ;; - *) die "mchecksum(): unkown method '${method}'" ;; + *) die "mchecksum(): unknown method '${method}'" ;; esac if [[ -d ${rundir} ]] @@ -82,6 +82,25 @@ return "${retval}" } +mcheckemptydir() +{ + local dir="$1" + local retval=1 + + if [[ ! -d ${dir} ]] + then + echo "mcheckemptydir(): '${dir}' is not a directory!" + retval=3 + else + shopt -s nullglob dotglob + files=( ${dir}/* ) + (( ${#files[*]} )) || retval=0 + shopt -u nullglob dotglob + fi + + return ${retval} +} + unpack_packages() { local list="$@" @@ -1401,10 +1420,10 @@ real_uris="$(convertmirrors ${uri})" # verbose or not - mqueryfeature "!verbose" && wget_opts="--quiet" + mqueryfeature "!verbose" && wget_opts+=" --quiet" # filter wget options if busybox was found - wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" + wget_opts+=" $(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" # create outputdir [[ ! -d ${outputdir} ]] && install -d "${outputdir}" @@ -1579,7 +1598,7 @@ else echo -ne "${COLBLUE} --- ${COLDEFAULT}" echo -n "checking md5sum... " - ( cd ${temp}; md5sum -c ${latest_md5} ) || die "md5 for ${latest_tarball} failed" + mchecksum --rundir "${temp}" --file "${latest_md5}" --method md5 || die "md5 for ${latest_tarball} failed" fi if [[ -d ${MAGEDIR} ]] @@ -1645,20 +1664,23 @@ } -# cuts full pathnames or versionized names down to basename -choppkgname() -{ - #we want this only if full name was used - if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] - then - #cuts ARCH and PBUILD - #ARCH comes from ${MAGERC} - MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") +# unused? +# +# # cuts full pathnames or versionized names down to basename +# choppkgname() +# { +# #we want this only if full name was used +# if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] +# then +# #cuts ARCH and PBUILD +# #ARCH comes from ${MAGERC} +# MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}$(print_distrotag)-r*.::g") +# +# #cuts version number +# MAGENAME=$(basename ${MAGENAME%-*} .mage) +# fi +# } - #cuts version number - MAGENAME=$(basename ${MAGENAME%-*} .mage) - fi -} # get_categorie $PNAME, returns CATEGORIE # $1=pname @@ -2759,7 +2781,7 @@ then echo -ne "${COLBLUE} *** ${COLDEFAULT}" echo -ne "checking md5sum (${count_current}/${count_total}): " - ( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed" + mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 || die "md5 for ${pkgfile} failed" else echo -ne "${COLBLUE} --- ${COLDEFAULT}" echo -e "!! no md5sum file found for ${pkgfile} :(" @@ -2999,6 +3021,7 @@ local state local descriptiom local homepage + local license local i local all_installed local ipver @@ -3035,13 +3058,14 @@ state="$(get_value_from_magefile STATE ${magefile})" description="$(get_value_from_magefile DESCRIPTION ${magefile})" homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" - + license="$(get_value_from_magefile LICENSE ${magefile})" + # all installed for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) do ipver="$(magename2pver ${i})" ipbuild="$(magename2pbuild ${i})" - + if [[ -z ${all_installed} ]] then all_installed="${ipver}-${ipbuild}" @@ -3050,7 +3074,7 @@ fi done [[ -z ${all_installed} ]] && all_installed="none" - + case ${state} in stable) state=${COLGREEN}"[s] ";; testing) state=${COLYELLOW}"[t] ";; @@ -3095,6 +3119,10 @@ echo " Installed versions: ${all_installed}" echo " Description: ${description}" echo " Homepage: ${homepage}" + if [[ ! -z ${license} ]] + then + echo " License: ${license}" + fi echo " Depends: ${deps}" echo " SDepends: ${sdeps}" echo @@ -3285,18 +3313,23 @@ ccache|!ccache) retval=0 ;; check|!check) retval=0 ;; compressdoc|!compressdoc) retval=0 ;; + debug|!debug) retval=0 ;; distcc|!distcc) retval=0 ;; kernelsrcunpack|!kernelsrcunpack) retval=0 ;; libtool|!libtool) retval=0 ;; linuxsymlink|!linuxsymlink) retval=0 ;; pkgbuild|!pkgbuild) retval=0 ;; + pkgdistrotag|!pkgdistrotag) retval=0 ;; purge|!purge) retval=0 ;; qalint|!qalint) retval=0 ;; regentree|!regentree) retval=0 ;; - stepbystep|!stepbystep) retval=0 ;; + resume|!resume) retval=0 ;; srcpkgbuild|!srcpkgbuild) retval=0 ;; srcpkgtarball|!srcpkgtarball) retval=0 ;; + static|!static) retval=0 ;; + stepbystep|!stepbystep) retval=0 ;; strip|!strip) retval=0 ;; + verbose|!verbose) retval=0 ;; *) retval=1 ;; esac @@ -3325,7 +3358,7 @@ if ! known_mage_feature "${feature}" then - [[ ${FVERBOSE} = off ]] || echo "unkown feature ${feature}, ignoring it" + [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}" return 3 fi @@ -3378,6 +3411,7 @@ fi done else + [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}" retval=3 fi