--- trunk/mage/usr/lib/mage/mage4.functions.sh 2012/10/25 07:17:17 1962 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2013/10/16 09:28:00 2232 @@ -46,6 +46,8 @@ local method local cmd local retval + local sum + local dest # very basic getops for i in $* @@ -72,9 +74,24 @@ if [[ -d ${rundir} ]] then pushd ${rundir} &> /dev/null - # be verbose here - ${cmd} -c ${file} #&> /dev/null - retval="$?" + + # all file must be non-zero + retval=0 + while read sum dest + do + if [ ! -s ${dest} ] + then + echo "${dest}: file is empty ;(" + retval=127 + fi + done < ${file} + if [[ ${retval} != 127 ]] + then + # be verbose here + ${cmd} -c ${file} #&> /dev/null + retval="$?" + fi + popd &> /dev/null else retval=1 @@ -102,12 +119,50 @@ return ${retval} } +unpack_package() +{ + local magefile="$1" + local pkg + local pkgtype + local tar_opts + + pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" + pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" + + xtitle "[ Unpacking ${pkg} ]" + + # abort on virtual pkg + if [[ ${pkgtype} = virtual ]] + then + echo -ne " ${COLBLUE}---${COLDEFAULT}" + echo " !unpack virtual ${pkg/.${PKGSUFFIX}/} ... " + continue + fi + + # abort on sources pkg + if [[ ${pkgtype} = sources ]] + then + echo -ne " ${COLBLUE}---${COLDEFAULT}" + echo " !unpack sources ${pkg/.${PKGSUFFIX}/} ... " + continue + fi + + # busybox? + if need_busybox_support tar + then + tar_opts="xjf" + else + tar_opts="xjmf" + fi + + echo -e " ${COLBLUE}***${COLDEFAULT} unpacking ${pkg} ... " + tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}" +} + unpack_packages() { local list="$@" local magefile - local pkg - local pkgtype local count_current local count_total local tar_opts @@ -120,38 +175,8 @@ for magefile in ${list} do - pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" - pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" - + unpack_package "${magefile}" (( count_current++ )) - xtitle "[ (${count_current}/${count_total}) Unpacking ${pkg} ]" - - # abort on virtual pkg - if [[ ${pkgtype} = virtual ]] - then - echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !unpack virtual (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... " - continue - fi - - # abort on sources pkg - if [[ ${pkgtype} = sources ]] - then - echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !unpack sources (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... " - continue - fi - - # busybox? - if need_busybox_support tar - then - tar_opts="xjf" - else - tar_opts="xjmf" - fi - - echo -e " ${COLBLUE}***${COLDEFAULT} unpacking (${count_current}/${count_total}): ${pkg} ... " - tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}" done # add a crlf for a better view @@ -1605,7 +1630,7 @@ then if ! mcheckemptydir ${MAGEDIR} then - find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r + find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xargs --no-run-if-empty rm -r fi else rm -rf ${MAGEDIR} @@ -1763,7 +1788,7 @@ then HIGHEST_MAGEFILE=${magefile} #for debug only - mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" + mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" >&2 fi done @@ -2689,6 +2714,7 @@ if [[ ${PKGTYPE} != virtual ]] && \ [[ ${PKGTYPE} != sources ]] then + unpack_package "${magefile}" echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... " build_doinstall ${PKGNAME} fi @@ -3279,7 +3305,7 @@ do if [[ -x ${busybox} ]] then - if [[ $(readlink $(which ${cmd})) = ${busybox} ]] + if [[ $(readlink $(type -P ${cmd})) = ${busybox} ]] then # needs busybox support return 0 @@ -3342,7 +3368,7 @@ { local feature="$1" local retval - + case "${feature}" in autosvc|!autosvc) retval=0 ;; buildlog|!buildlog) retval=0 ;; @@ -3351,6 +3377,7 @@ compressdoc|!compressdoc) retval=0 ;; debug|!debug) retval=0 ;; distcc|!distcc) retval=0 ;; + icecc|!icecc) retval=0 ;; kernelsrcunpack|!kernelsrcunpack) retval=0 ;; libtool|!libtool) retval=0 ;; linuxsymlink|!linuxsymlink) retval=0 ;;